Reduced dependencies for GTC extensions

This commit is contained in:
Christophe Riccio 2013-12-24 13:45:14 +01:00
parent 6f7eb97b87
commit 950eaa45cb
44 changed files with 408 additions and 283 deletions

139
glm/detail/_noise.hpp Normal file
View File

@ -0,0 +1,139 @@
///////////////////////////////////////////////////////////////////////////////////
/// 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 core
/// @file glm/detail/_noise.hpp
/// @date 2013-12-24 / 2013-12-24
/// @author Christophe Riccio
///////////////////////////////////////////////////////////////////////////////////
#ifndef GLM_DETAIL_NOISE_INCLUDED
#define GLM_DETAIL_NOISE_INCLUDED
namespace glm{
namespace detail
{
template <typename T>
GLM_FUNC_QUALIFIER T mod289(T const & x)
{
return x - floor(x * T(1.0 / 289.0)) * T(289.0);
}
template <typename T>
GLM_FUNC_QUALIFIER T permute(T const & x)
{
return mod289(((x * T(34)) + T(1)) * x);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec2<T, P> permute(tvec2<T, P> const & x)
{
return mod289(((x * T(34)) + T(1)) * x);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec3<T, P> permute(tvec3<T, P> const & x)
{
return mod289(((x * T(34)) + T(1)) * x);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec4<T, P> permute(tvec4<T, P> const & x)
{
return mod289(((x * T(34)) + T(1)) * x);
}
/*
template <typename T, precision P, template<typename> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> permute(vecType<T, P> const & x)
{
return mod289(((x * T(34)) + T(1)) * x);
}
*/
template <typename T>
GLM_FUNC_QUALIFIER T taylorInvSqrt(T const & r)
{
return T(1.79284291400159) - T(0.85373472095314) * r;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER detail::tvec2<T, P> taylorInvSqrt(detail::tvec2<T, P> const & r)
{
return T(1.79284291400159) - T(0.85373472095314) * r;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER detail::tvec3<T, P> taylorInvSqrt(detail::tvec3<T, P> const & r)
{
return T(1.79284291400159) - T(0.85373472095314) * r;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER detail::tvec4<T, P> taylorInvSqrt(detail::tvec4<T, P> const & r)
{
return T(1.79284291400159) - T(0.85373472095314) * r;
}
/*
template <typename T, precision P, template<typename> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> taylorInvSqrt(vecType<T, P> const & r)
{
return T(1.79284291400159) - T(0.85373472095314) * r;
}
*/
template <typename T, precision P>
GLM_FUNC_QUALIFIER detail::tvec2<T, P> fade(detail::tvec2<T, P> const & t)
{
return (t * t * t) * (t * (t * T(6) - T(15)) + T(10));
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER detail::tvec3<T, P> fade(detail::tvec3<T, P> const & t)
{
return (t * t * t) * (t * (t * T(6) - T(15)) + T(10));
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER detail::tvec4<T, P> fade(detail::tvec4<T, P> const & t)
{
return (t * t * t) * (t * (t * T(6) - T(15)) + T(10));
}
/*
template <typename T, precision P, template <typename> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> fade(vecType<T, P> const & t)
{
return (t * t * t) * (t * (t * T(6) - T(15)) + T(10));
}
*/
template <typename T, precision P>
GLM_FUNC_QUALIFIER detail::tvec4<T, P> grad4(T const & j, detail::tvec4<T, P> const & ip)
{
detail::tvec3<T, P> pXYZ = floor(fract(detail::tvec3<T, P>(j) * detail::tvec3<T, P>(ip)) * T(7)) * ip[2] - T(1);
T pW = static_cast<T>(1.5) - dot(abs(pXYZ), detail::tvec3<T, P>(1));
detail::tvec4<T, P> s = detail::tvec4<T, P>(lessThan(detail::tvec4<T, P>(pXYZ, pW), detail::tvec4<T, P>(0.0)));
pXYZ = pXYZ + (detail::tvec3<T, P>(s) * T(2) - T(1)) * s.w;
return detail::tvec4<T, P>(pXYZ, pW);
}
}//namespace detail
}//namespace glm
#endif//GLM_DETAIL_NOISE_INCLUDED

View File

@ -33,8 +33,8 @@
/// These all operate component-wise. The description is per component.
///////////////////////////////////////////////////////////////////////////////////
#ifndef GLM_CORE_func_common
#define GLM_CORE_func_common GLM_VERSION
#ifndef GLM_FUNC_COMMON_INCLUDED
#define GLM_FUNC_COMMON_INCLUDED
#include "setup.hpp"
#include "_fixes.hpp"
@ -455,4 +455,4 @@ namespace glm
#include "func_common.inl"
#endif//GLM_CORE_func_common
#endif//GLM_FUNC_COMMON_INCLUDED

View File

@ -34,12 +34,13 @@
///////////////////////////////////////////////////////////////////////////////////
#ifndef glm_core_func_exponential
#define glm_core_func_exponential GLM_VERSION
#define glm_core_func_exponential
#include "type_vec1.hpp"
#include "type_vec2.hpp"
#include "type_vec3.hpp"
#include "type_vec4.hpp"
#include <cmath>
namespace glm
{

View File

@ -30,7 +30,6 @@
#include "_vectorize.hpp"
#include <limits>
#include <cassert>
#include <cmath>
namespace glm
{

View File

@ -34,7 +34,7 @@
///////////////////////////////////////////////////////////////////////////////////
#ifndef glm_core_func_geometric
#define glm_core_func_geometric GLM_VERSION
#define glm_core_func_geometric
#include "type_vec3.hpp"

View File

@ -36,7 +36,7 @@
///////////////////////////////////////////////////////////////////////////////////
#ifndef glm_core_func_integer
#define glm_core_func_integer GLM_VERSION
#define glm_core_func_integer
#include "setup.hpp"

View File

@ -38,7 +38,7 @@
///////////////////////////////////////////////////////////////////////////////////
#ifndef GLM_CORE_func_matrix
#define GLM_CORE_func_matrix GLM_VERSION
#define GLM_CORE_func_matrix
#include "type_mat2x2.hpp"
#include "type_mat2x3.hpp"

View File

@ -26,7 +26,11 @@
/// @author Christophe Riccio
///////////////////////////////////////////////////////////////////////////////////
#include "func_geometric.hpp"
#include "../geometric.hpp"
#include "../vec2.hpp"
#include "../vec3.hpp"
#include "../vec4.hpp"
#include <limits>
namespace glm
{

View File

@ -36,7 +36,7 @@
///////////////////////////////////////////////////////////////////////////////////
#ifndef glm_core_func_noise
#define glm_core_func_noise GLM_VERSION
#define glm_core_func_noise
#include "type_vec1.hpp"
#include "type_vec2.hpp"

View File

@ -26,6 +26,9 @@
/// @author Christophe Riccio
///////////////////////////////////////////////////////////////////////////////////
#include "../detail/_noise.hpp"
#include "./func_common.hpp"
namespace glm
{
template <typename T>
@ -87,8 +90,8 @@ namespace glm
// Permutations
i = mod(i, T(289)); // Avoid truncation effects in permutation
detail::tvec3<T, P> p = permute(
permute(i.y + detail::tvec3<T, P>(T(0), i1.y, T(1))) + i.x + detail::tvec3<T, P>(T(0), i1.x, T(1)));
detail::tvec3<T, P> p = detail::permute(
detail::permute(i.y + detail::tvec3<T, P>(T(0), i1.y, T(1))) + i.x + detail::tvec3<T, P>(T(0), i1.x, T(1)));
detail::tvec3<T, P> m = max(T(0.5) - detail::tvec3<T, P>(
dot(x0, x0),
@ -145,7 +148,7 @@ namespace glm
// Permutations
i = mod289(i);
detail::tvec4<T, P> p(permute(permute(permute(
detail::tvec4<T, P> p(detail::permute(detail::permute(detail::permute(
i.z + detail::tvec4<T, P>(T(0), i1.z, i2.z, T(1))) +
i.y + detail::tvec4<T, P>(T(0), i1.y, i2.y, T(1))) +
i.x + detail::tvec4<T, P>(T(0), i1.x, i2.x, T(1))));
@ -248,8 +251,8 @@ namespace glm
// Permutations
i = mod(i, T(289));
T j0 = permute(permute(permute(permute(i.w) + i.z) + i.y) + i.x);
detail::tvec4<T, P> j1 = permute(permute(permute(permute(
T j0 = detail::permute(detail::permute(detail::permute(detail::permute(i.w) + i.z) + i.y) + i.x);
detail::tvec4<T, P> j1 = detail::permute(detail::permute(detail::permute(detail::permute(
i.w + detail::tvec4<T, P>(i1.w, i2.w, i3.w, T(1))) +
i.z + detail::tvec4<T, P>(i1.z, i2.z, i3.z, T(1))) +
i.y + detail::tvec4<T, P>(i1.y, i2.y, i3.y, T(1))) +
@ -259,14 +262,14 @@ namespace glm
// 7*7*6 = 294, which is close to the ring size 17*17 = 289.
detail::tvec4<T, P> ip = detail::tvec4<T, P>(T(1) / T(294), T(1) / T(49), T(1) / T(7), T(0));
detail::tvec4<T, P> p0 = grad4(j0, ip);
detail::tvec4<T, P> p1 = grad4(j1.x, ip);
detail::tvec4<T, P> p2 = grad4(j1.y, ip);
detail::tvec4<T, P> p3 = grad4(j1.z, ip);
detail::tvec4<T, P> p4 = grad4(j1.w, ip);
detail::tvec4<T, P> p0 = detail::grad4(j0, ip);
detail::tvec4<T, P> p1 = detail::grad4(j1.x, ip);
detail::tvec4<T, P> p2 = detail::grad4(j1.y, ip);
detail::tvec4<T, P> p3 = detail::grad4(j1.z, ip);
detail::tvec4<T, P> p4 = detail::grad4(j1.w, ip);
// Normalise gradients
detail::tvec4<T, P> norm = taylorInvSqrt(detail::tvec4<T, P>(dot(p0, p0), dot(p1, p1), dot(p2, p2), dot(p3, p3)));
detail::tvec4<T, P> norm = detail::taylorInvSqrt(detail::tvec4<T, P>(dot(p0, p0), dot(p1, p1), dot(p2, p2), dot(p3, p3)));
p0 *= norm.x;
p1 *= norm.y;
p2 *= norm.z;

View File

@ -34,7 +34,7 @@
///////////////////////////////////////////////////////////////////////////////////
#ifndef GLM_CORE_func_packing
#define GLM_CORE_func_packing GLM_VERSION
#define GLM_CORE_func_packing
#include "type_vec2.hpp"
#include "type_vec4.hpp"

View File

@ -38,7 +38,7 @@
///////////////////////////////////////////////////////////////////////////////////
#ifndef GLM_CORE_func_trigonometric
#define GLM_CORE_func_trigonometric GLM_VERSION
#define GLM_CORE_func_trigonometric
namespace glm
{

View File

@ -27,6 +27,8 @@
///////////////////////////////////////////////////////////////////////////////////
#include "_vectorize.hpp"
#include <cmath>
#include <limits>
namespace glm
{

View File

@ -39,7 +39,7 @@
///////////////////////////////////////////////////////////////////////////////////
#ifndef GLM_CORE_func_vector_relational
#define GLM_CORE_func_vector_relational GLM_VERSION
#define GLM_CORE_func_vector_relational
#include "precision.hpp"
#include "setup.hpp"

View File

@ -39,8 +39,8 @@
#ifndef GLM_GTC_constants
#define GLM_GTC_constants
// Dependency:
#include "../glm.hpp"
// Dependencies
#include "../detail/setup.hpp"
#if(defined(GLM_MESSAGES) && !defined(GLM_EXT_INCLUDED))
# pragma message("GLM: GLM_GTC_constants extension included")

View File

@ -26,6 +26,8 @@
/// @author Christophe Riccio
///////////////////////////////////////////////////////////////////////////////////
#include <limits>
namespace glm
{
template <typename genType>

View File

@ -40,9 +40,8 @@
#ifndef GLM_GTC_epsilon
#define GLM_GTC_epsilon
// Dependency:
#include "../glm.hpp"
#include "../gtc/quaternion.hpp"
// Dependencies
#include "../detail/setup.hpp"
#if(defined(GLM_MESSAGES) && !defined(GLM_EXT_INCLUDED))
# pragma message("GLM: GLM_GTC_epsilon extension included")
@ -58,19 +57,19 @@ namespace glm
///
/// @see gtc_epsilon
template <typename genType>
typename genType::boolType epsilonEqual(
typename genType::bool_type epsilonEqual(
genType const & x,
genType const & y,
typename genType::T const & epsilon);
typename genType::value_type const & epsilon);
/// Returns the component-wise comparison of |x - y| < epsilon.
/// True if this expression is satisfied.
///
/// @see gtc_epsilon
template <typename genType>
typename genType::boolType epsilonEqual(
genType const & x,
genType const & y,
template <typename genType>
typename genType::bool_type epsilonEqual(
genType const & x,
genType const & y,
genType const & epsilon);
/// Returns the component-wise comparison of |x - y| < epsilon.
@ -81,7 +80,7 @@ namespace glm
typename genType::boolType epsilonNotEqual(
genType const & x,
genType const & y,
typename genType::T const & epsilon);
typename genType::value_type const & epsilon);
/// Returns the component-wise comparison of |x - y| >= epsilon.
/// True if this expression is not satisfied.
@ -89,8 +88,8 @@ namespace glm
/// @see gtc_epsilon
template <typename genType>
typename genType::boolType epsilonNotEqual(
genType const & x,
genType const & y,
genType const & x,
genType const & y,
genType const & epsilon);
/// @}

View File

@ -26,6 +26,13 @@
/// @author Christophe Riccio
///////////////////////////////////////////////////////////////////////////////////
// Dependency:
#include "quaternion.hpp"
#include "../common.hpp"
#include "../vec2.hpp"
#include "../vec3.hpp"
#include "../vec4.hpp"
namespace glm
{
GLM_FUNC_QUALIFIER bool epsilonEqual

View File

@ -38,7 +38,7 @@
#define GLM_GTC_matrix_access
// Dependency:
#include "../glm.hpp"
#include "../detail/setup.hpp"
#if(defined(GLM_MESSAGES) && !defined(GLM_EXT_INCLUDED))
# pragma message("GLM: GLM_GTC_matrix_access extension included")
@ -51,32 +51,32 @@ namespace glm
/// Get a specific row of a matrix.
/// @see gtc_matrix_access
template <typename genType>
template <typename genType>
typename genType::row_type row(
genType const & m,
typename genType::size_type const & index);
length_t const & index);
/// Set a specific row to a matrix.
/// @see gtc_matrix_access
template <typename genType>
template <typename genType>
genType row(
genType const & m,
typename genType::size_type const & index,
genType const & m,
length_t const & index,
typename genType::row_type const & x);
/// Get a specific column of a matrix.
/// @see gtc_matrix_access
template <typename genType>
template <typename genType>
typename genType::col_type column(
genType const & m,
typename genType::size_type const & index);
genType const & m,
length_t const & index);
/// Set a specific column to a matrix.
/// @see gtc_matrix_access
template <typename genType>
template <typename genType>
genType column(
genType const & m,
typename genType::size_type const & index,
genType const & m,
length_t const & index,
typename genType::col_type const & x);
/// @}

View File

@ -38,7 +38,15 @@
#define GLM_GTC_matrix_integer
// Dependency:
#include "../glm.hpp"
#include "../mat2x2.hpp"
#include "../mat2x3.hpp"
#include "../mat2x4.hpp"
#include "../mat3x2.hpp"
#include "../mat3x3.hpp"
#include "../mat3x4.hpp"
#include "../mat4x2.hpp"
#include "../mat4x3.hpp"
#include "../mat4x4.hpp"
#if(defined(GLM_MESSAGES) && !defined(GLM_EXT_INCLUDED))
# pragma message("GLM: GLM_GTC_matrix_integer extension included")

View File

@ -37,8 +37,8 @@
#ifndef GLM_GTC_matrix_inverse
#define GLM_GTC_matrix_inverse
// Dependency:
#include "../glm.hpp"
// Dependencies
#include "../detail/setup.hpp"
#if(defined(GLM_MESSAGES) && !defined(GLM_EXT_INCLUDED))
# pragma message("GLM: GLM_GTC_matrix_inverse extension included")
@ -55,7 +55,7 @@ namespace glm
/// @tparam genType Squared floating-point matrix: half, float or double. Inverse of matrix based of half-precision floating point value is highly innacurate.
/// @see gtc_matrix_inverse
template <typename genType>
genType affineInverse(genType const & m);
GLM_FUNC_QUALIFIER genType affineInverse(genType const & m);
/// Compute the inverse transpose of a matrix.
///

View File

@ -26,6 +26,10 @@
/// @author Christophe Riccio
///////////////////////////////////////////////////////////////////////////////////
#include "../mat2x2.hpp"
#include "../mat3x3.hpp"
#include "../mat4x4.hpp"
namespace glm
{
template <typename T, precision P>

View File

@ -47,7 +47,10 @@
#define GLM_GTC_matrix_transform
// Dependency:
#include "../glm.hpp"
#include "../mat4x4.hpp"
#include "../vec2.hpp"
#include "../vec3.hpp"
#include "../vec4.hpp"
#if(defined(GLM_MESSAGES) && !defined(GLM_EXT_INCLUDED))
# pragma message("GLM: GLM_GTC_matrix_transform extension included")

View File

@ -26,6 +26,9 @@
/// @author Christophe Riccio
///////////////////////////////////////////////////////////////////////////////////
#include "../geometric.hpp"
#include "../trigonometric.hpp"
namespace glm
{
template <typename T, precision P>

View File

@ -41,8 +41,8 @@
#ifndef GLM_GTC_noise
#define GLM_GTC_noise
// Dependency:
#include "../glm.hpp"
// Dependencies
#include "../detail/setup.hpp"
#if(defined(GLM_MESSAGES) && !defined(GLM_EXT_INCLUDED))
# pragma message("GLM: GLM_GTC_noise extension included")
@ -55,22 +55,22 @@ namespace glm
/// Classic perlin noise.
/// @see gtc_noise
template <typename T, template<typename> class vecType>
template <typename T, precision P, template<typename, precision> class vecType>
T perlin(
vecType<T> const & p);
vecType<T, P> const & p);
/// Periodic perlin noise.
/// @see gtc_noise
template <typename T, template<typename> class vecType>
template <typename T, precision P, template<typename, precision> class vecType>
T perlin(
vecType<T> const & p,
vecType<T> const & rep);
vecType<T, P> const & p,
vecType<T, P> const & rep);
/// Simplex noise.
/// @see gtc_noise
template <typename T, template<typename> class vecType>
template <typename T, precision P, template<typename, precision> class vecType>
T simplex(
vecType<T> const & p);
vecType<T, P> const & p);
/// @}
}//namespace glm

View File

@ -31,109 +31,13 @@
// http://www.itn.liu.se/~stegu/simplexnoise/simplexnoise.pdf
///////////////////////////////////////////////////////////////////////////////////
#include "../geometric.hpp"
#include "../common.hpp"
#include "../vector_relational.hpp"
#include "../detail/_noise.hpp"
namespace glm
{
template <typename T>
GLM_FUNC_QUALIFIER T mod289(T const & x)
{
return x - floor(x * T(1.0 / 289.0)) * T(289.0);
}
template <typename T>
GLM_FUNC_QUALIFIER T permute(T const & x)
{
return mod289(((x * T(34)) + T(1)) * x);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER detail::tvec2<T, P> permute(detail::tvec2<T, P> const & x)
{
return mod289(((x * T(34)) + T(1)) * x);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER detail::tvec3<T, P> permute(detail::tvec3<T, P> const & x)
{
return mod289(((x * T(34)) + T(1)) * x);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER detail::tvec4<T, P> permute(detail::tvec4<T, P> const & x)
{
return mod289(((x * T(34)) + T(1)) * x);
}
/*
template <typename T, precision P, template<typename> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> permute(vecType<T, P> const & x)
{
return mod289(((x * T(34)) + T(1)) * x);
}
*/
template <typename T>
GLM_FUNC_QUALIFIER T taylorInvSqrt(T const & r)
{
return T(1.79284291400159) - T(0.85373472095314) * r;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER detail::tvec2<T, P> taylorInvSqrt(detail::tvec2<T, P> const & r)
{
return T(1.79284291400159) - T(0.85373472095314) * r;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER detail::tvec3<T, P> taylorInvSqrt(detail::tvec3<T, P> const & r)
{
return T(1.79284291400159) - T(0.85373472095314) * r;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER detail::tvec4<T, P> taylorInvSqrt(detail::tvec4<T, P> const & r)
{
return T(1.79284291400159) - T(0.85373472095314) * r;
}
/*
template <typename T, precision P, template<typename> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> taylorInvSqrt(vecType<T, P> const & r)
{
return T(1.79284291400159) - T(0.85373472095314) * r;
}
*/
template <typename T, precision P>
GLM_FUNC_QUALIFIER detail::tvec2<T, P> fade(detail::tvec2<T, P> const & t)
{
return (t * t * t) * (t * (t * T(6) - T(15)) + T(10));
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER detail::tvec3<T, P> fade(detail::tvec3<T, P> const & t)
{
return (t * t * t) * (t * (t * T(6) - T(15)) + T(10));
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER detail::tvec4<T, P> fade(detail::tvec4<T, P> const & t)
{
return (t * t * t) * (t * (t * T(6) - T(15)) + T(10));
}
/*
template <typename T, precision P, template <typename> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> fade(vecType<T, P> const & t)
{
return (t * t * t) * (t * (t * T(6) - T(15)) + T(10));
}
*/
template <typename T, precision P>
GLM_FUNC_QUALIFIER detail::tvec4<T, P> grad4(T const & j, detail::tvec4<T, P> const & ip)
{
detail::tvec3<T, P> pXYZ = floor(fract(detail::tvec3<T, P>(j) * detail::tvec3<T, P>(ip)) * T(7)) * ip[2] - T(1);
T pW = static_cast<T>(1.5) - dot(abs(pXYZ), detail::tvec3<T, P>(1));
detail::tvec4<T, P> s = detail::tvec4<T, P>(lessThan(detail::tvec4<T, P>(pXYZ, pW), detail::tvec4<T, P>(0.0)));
pXYZ = pXYZ + (detail::tvec3<T, P>(s) * T(2) - T(1)) * s.w;
return detail::tvec4<T, P>(pXYZ, pW);
}
// Classic Perlin noise
template <typename T, precision P>
GLM_FUNC_QUALIFIER T perlin(detail::tvec2<T, P> const & Position)
@ -146,7 +50,7 @@ namespace glm
detail::tvec4<T, P> fx(Pf.x, Pf.z, Pf.x, Pf.z);
detail::tvec4<T, P> fy(Pf.y, Pf.y, Pf.w, Pf.w);
detail::tvec4<T, P> i = glm::permute(glm::permute(ix) + iy);
detail::tvec4<T, P> i = detail::permute(detail::permute(ix) + iy);
detail::tvec4<T, P> gx = static_cast<T>(2) * glm::fract(i / T(41)) - T(1);
detail::tvec4<T, P> gy = glm::abs(gx) - T(0.5);
@ -190,9 +94,9 @@ namespace glm
detail::tvec4<T, P> iz0(Pi0.z);
detail::tvec4<T, P> iz1(Pi1.z);
detail::tvec4<T, P> ixy = permute(permute(ix) + iy);
detail::tvec4<T, P> ixy0 = permute(ixy + iz0);
detail::tvec4<T, P> ixy1 = permute(ixy + iz1);
detail::tvec4<T, P> ixy = detail::permute(detail::permute(ix) + iy);
detail::tvec4<T, P> ixy0 = detail::permute(ixy + iz0);
detail::tvec4<T, P> ixy1 = detail::permute(ixy + iz1);
detail::tvec4<T, P> gx0 = ixy0 * T(1.0 / 7.0);
detail::tvec4<T, P> gy0 = fract(floor(gx0) * T(1.0 / 7.0)) - T(0.5);
@ -219,12 +123,12 @@ namespace glm
detail::tvec3<T, P> g011(gx1.z, gy1.z, gz1.z);
detail::tvec3<T, P> g111(gx1.w, gy1.w, gz1.w);
detail::tvec4<T, P> norm0 = taylorInvSqrt(detail::tvec4<T, P>(dot(g000, g000), dot(g010, g010), dot(g100, g100), dot(g110, g110)));
detail::tvec4<T, P> norm0 = detail::taylorInvSqrt(detail::tvec4<T, P>(dot(g000, g000), dot(g010, g010), dot(g100, g100), dot(g110, g110)));
g000 *= norm0.x;
g010 *= norm0.y;
g100 *= norm0.z;
g110 *= norm0.w;
detail::tvec4<T, P> norm1 = taylorInvSqrt(detail::tvec4<T, P>(dot(g001, g001), dot(g011, g011), dot(g101, g101), dot(g111, g111)));
detail::tvec4<T, P> norm1 = detail::taylorInvSqrt(detail::tvec4<T, P>(dot(g001, g001), dot(g011, g011), dot(g101, g101), dot(g111, g111)));
g001 *= norm1.x;
g011 *= norm1.y;
g101 *= norm1.z;
@ -336,13 +240,13 @@ namespace glm
detail::tvec4<T, P> iw0(Pi0.w);
detail::tvec4<T, P> iw1(Pi1.w);
detail::tvec4<T, P> ixy = permute(permute(ix) + iy);
detail::tvec4<T, P> ixy0 = permute(ixy + iz0);
detail::tvec4<T, P> ixy1 = permute(ixy + iz1);
detail::tvec4<T, P> ixy00 = permute(ixy0 + iw0);
detail::tvec4<T, P> ixy01 = permute(ixy0 + iw1);
detail::tvec4<T, P> ixy10 = permute(ixy1 + iw0);
detail::tvec4<T, P> ixy11 = permute(ixy1 + iw1);
detail::tvec4<T, P> ixy = detail::permute(detail::permute(ix) + iy);
detail::tvec4<T, P> ixy0 = detail::permute(ixy + iz0);
detail::tvec4<T, P> ixy1 = detail::permute(ixy + iz1);
detail::tvec4<T, P> ixy00 = detail::permute(ixy0 + iw0);
detail::tvec4<T, P> ixy01 = detail::permute(ixy0 + iw1);
detail::tvec4<T, P> ixy10 = detail::permute(ixy1 + iw0);
detail::tvec4<T, P> ixy11 = detail::permute(ixy1 + iw1);
detail::tvec4<T, P> gx00 = ixy00 / T(7);
detail::tvec4<T, P> gy00 = floor(gx00) / T(7);
@ -405,25 +309,25 @@ namespace glm
detail::tvec4<T, P> g0111(gx11.z, gy11.z, gz11.z, gw11.z);
detail::tvec4<T, P> g1111(gx11.w, gy11.w, gz11.w, gw11.w);
detail::tvec4<T, P> norm00 = taylorInvSqrt(detail::tvec4<T, P>(dot(g0000, g0000), dot(g0100, g0100), dot(g1000, g1000), dot(g1100, g1100)));
detail::tvec4<T, P> norm00 = detail::taylorInvSqrt(detail::tvec4<T, P>(dot(g0000, g0000), dot(g0100, g0100), dot(g1000, g1000), dot(g1100, g1100)));
g0000 *= norm00.x;
g0100 *= norm00.y;
g1000 *= norm00.z;
g1100 *= norm00.w;
detail::tvec4<T, P> norm01 = taylorInvSqrt(detail::tvec4<T, P>(dot(g0001, g0001), dot(g0101, g0101), dot(g1001, g1001), dot(g1101, g1101)));
detail::tvec4<T, P> norm01 = detail::taylorInvSqrt(detail::tvec4<T, P>(dot(g0001, g0001), dot(g0101, g0101), dot(g1001, g1001), dot(g1101, g1101)));
g0001 *= norm01.x;
g0101 *= norm01.y;
g1001 *= norm01.z;
g1101 *= norm01.w;
detail::tvec4<T, P> norm10 = taylorInvSqrt(detail::tvec4<T, P>(dot(g0010, g0010), dot(g0110, g0110), dot(g1010, g1010), dot(g1110, g1110)));
detail::tvec4<T, P> norm10 = detail::taylorInvSqrt(detail::tvec4<T, P>(dot(g0010, g0010), dot(g0110, g0110), dot(g1010, g1010), dot(g1110, g1110)));
g0010 *= norm10.x;
g0110 *= norm10.y;
g1010 *= norm10.z;
g1110 *= norm10.w;
detail::tvec4<T, P> norm11 = taylorInvSqrt(detail::tvec4<T, P>(dot(g0011, g0011), dot(g0111, g0111), dot(g1011, g1011), dot(g1111, g1111)));
detail::tvec4<T, P> norm11 = detail::taylorInvSqrt(detail::tvec4<T, P>(dot(g0011, g0011), dot(g0111, g0111), dot(g1011, g1011), dot(g1111, g1111)));
g0011 *= norm11.x;
g0111 *= norm11.y;
g1011 *= norm11.z;
@ -468,7 +372,7 @@ namespace glm
detail::tvec4<T, P> fx(Pf.x, Pf.z, Pf.x, Pf.z);
detail::tvec4<T, P> fy(Pf.y, Pf.y, Pf.w, Pf.w);
detail::tvec4<T, P> i = permute(permute(ix) + iy);
detail::tvec4<T, P> i = detail::permute(detail::permute(ix) + iy);
detail::tvec4<T, P> gx = static_cast<T>(2) * fract(i / T(41)) - T(1);
detail::tvec4<T, P> gy = abs(gx) - T(0.5);
@ -480,7 +384,7 @@ namespace glm
detail::tvec2<T, P> g01(gx.z, gy.z);
detail::tvec2<T, P> g11(gx.w, gy.w);
detail::tvec4<T, P> norm = taylorInvSqrt(detail::tvec4<T, P>(dot(g00, g00), dot(g01, g01), dot(g10, g10), dot(g11, g11)));
detail::tvec4<T, P> norm = detail::taylorInvSqrt(detail::tvec4<T, P>(dot(g00, g00), dot(g01, g01), dot(g10, g10), dot(g11, g11)));
g00 *= norm.x;
g01 *= norm.y;
g10 *= norm.z;
@ -512,9 +416,9 @@ namespace glm
detail::tvec4<T, P> iz0(Pi0.z);
detail::tvec4<T, P> iz1(Pi1.z);
detail::tvec4<T, P> ixy = permute(permute(ix) + iy);
detail::tvec4<T, P> ixy0 = permute(ixy + iz0);
detail::tvec4<T, P> ixy1 = permute(ixy + iz1);
detail::tvec4<T, P> ixy = detail::permute(detail::permute(ix) + iy);
detail::tvec4<T, P> ixy0 = detail::permute(ixy + iz0);
detail::tvec4<T, P> ixy1 = detail::permute(ixy + iz1);
detail::tvec4<T, P> gx0 = ixy0 / T(7);
detail::tvec4<T, P> gy0 = fract(floor(gx0) / T(7)) - T(0.5);
@ -541,12 +445,12 @@ namespace glm
detail::tvec3<T, P> g011 = detail::tvec3<T, P>(gx1.z, gy1.z, gz1.z);
detail::tvec3<T, P> g111 = detail::tvec3<T, P>(gx1.w, gy1.w, gz1.w);
detail::tvec4<T, P> norm0 = taylorInvSqrt(detail::tvec4<T, P>(dot(g000, g000), dot(g010, g010), dot(g100, g100), dot(g110, g110)));
detail::tvec4<T, P> norm0 = detail::taylorInvSqrt(detail::tvec4<T, P>(dot(g000, g000), dot(g010, g010), dot(g100, g100), dot(g110, g110)));
g000 *= norm0.x;
g010 *= norm0.y;
g100 *= norm0.z;
g110 *= norm0.w;
detail::tvec4<T, P> norm1 = taylorInvSqrt(detail::tvec4<T, P>(dot(g001, g001), dot(g011, g011), dot(g101, g101), dot(g111, g111)));
detail::tvec4<T, P> norm1 = detail::taylorInvSqrt(detail::tvec4<T, P>(dot(g001, g001), dot(g011, g011), dot(g101, g101), dot(g111, g111)));
g001 *= norm1.x;
g011 *= norm1.y;
g101 *= norm1.z;
@ -564,7 +468,7 @@ namespace glm
detail::tvec3<T, P> fade_xyz = fade(Pf0);
detail::tvec4<T, P> n_z = mix(detail::tvec4<T, P>(n000, n100, n010, n110), detail::tvec4<T, P>(n001, n101, n011, n111), fade_xyz.z);
detail::tvec2<T, P> n_yz = mix(detail::tvec2<T, P>(n_z.x, n_z.y), detail::tvec2<T, P>(n_z.z, n_z.w), fade_xyz.y);
T n_xyz = mix(n_yz.x, n_yz.y, fade_xyz.x);
T n_xyz = mix(n_yz.x, n_yz.y, fade_xyz.x);
return T(2.2) * n_xyz;
}
@ -583,13 +487,13 @@ namespace glm
detail::tvec4<T, P> iw0(Pi0.w);
detail::tvec4<T, P> iw1(Pi1.w);
detail::tvec4<T, P> ixy = permute(permute(ix) + iy);
detail::tvec4<T, P> ixy0 = permute(ixy + iz0);
detail::tvec4<T, P> ixy1 = permute(ixy + iz1);
detail::tvec4<T, P> ixy00 = permute(ixy0 + iw0);
detail::tvec4<T, P> ixy01 = permute(ixy0 + iw1);
detail::tvec4<T, P> ixy10 = permute(ixy1 + iw0);
detail::tvec4<T, P> ixy11 = permute(ixy1 + iw1);
detail::tvec4<T, P> ixy = detail::permute(detail::permute(ix) + iy);
detail::tvec4<T, P> ixy0 = detail::permute(ixy + iz0);
detail::tvec4<T, P> ixy1 = detail::permute(ixy + iz1);
detail::tvec4<T, P> ixy00 = detail::permute(ixy0 + iw0);
detail::tvec4<T, P> ixy01 = detail::permute(ixy0 + iw1);
detail::tvec4<T, P> ixy10 = detail::permute(ixy1 + iw0);
detail::tvec4<T, P> ixy11 = detail::permute(ixy1 + iw1);
detail::tvec4<T, P> gx00 = ixy00 / T(7);
detail::tvec4<T, P> gy00 = floor(gx00) / T(7);
@ -652,13 +556,13 @@ namespace glm
detail::tvec4<T, P> g0111(gx11.z, gy11.z, gz11.z, gw11.z);
detail::tvec4<T, P> g1111(gx11.w, gy11.w, gz11.w, gw11.w);
detail::tvec4<T, P> norm00 = taylorInvSqrt(detail::tvec4<T, P>(dot(g0000, g0000), dot(g0100, g0100), dot(g1000, g1000), dot(g1100, g1100)));
detail::tvec4<T, P> norm00 = detail::taylorInvSqrt(detail::tvec4<T, P>(dot(g0000, g0000), dot(g0100, g0100), dot(g1000, g1000), dot(g1100, g1100)));
g0000 *= norm00.x;
g0100 *= norm00.y;
g1000 *= norm00.z;
g1100 *= norm00.w;
detail::tvec4<T, P> norm01 = taylorInvSqrt(detail::tvec4<T, P>(dot(g0001, g0001), dot(g0101, g0101), dot(g1001, g1001), dot(g1101, g1101)));
detail::tvec4<T, P> norm01 = detail::taylorInvSqrt(detail::tvec4<T, P>(dot(g0001, g0001), dot(g0101, g0101), dot(g1001, g1001), dot(g1101, g1101)));
g0001 *= norm01.x;
g0101 *= norm01.y;
g1001 *= norm01.z;
@ -727,8 +631,8 @@ namespace glm
// Permutations
i = mod(i, T(289)); // Avoid truncation effects in permutation
detail::tvec3<T, P> p = permute(
permute(i.y + detail::tvec3<T, P>(T(0), i1.y, T(1)))
detail::tvec3<T, P> p = detail::permute(
detail::permute(i.y + detail::tvec3<T, P>(T(0), i1.y, T(1)))
+ i.x + detail::tvec3<T, P>(T(0), i1.x, T(1)));
detail::tvec3<T, P> m = max(T(0.5) - detail::tvec3<T, P>(
@ -785,9 +689,9 @@ namespace glm
// Permutations
i = mod289(i);
detail::tvec4<T, P> p(permute(permute(permute(
i.z + detail::tvec4<T, P>(T(0), i1.z, i2.z, T(1))) +
i.y + detail::tvec4<T, P>(T(0), i1.y, i2.y, T(1))) +
detail::tvec4<T, P> p(detail::permute(detail::permute(detail::permute(
i.z + detail::tvec4<T, P>(T(0), i1.z, i2.z, T(1))) +
i.y + detail::tvec4<T, P>(T(0), i1.y, i2.y, T(1))) +
i.x + detail::tvec4<T, P>(T(0), i1.x, i2.x, T(1))));
// Gradients: 7x7 points over a square, mapped onto an octahedron.
@ -822,7 +726,7 @@ namespace glm
detail::tvec3<T, P> p3(a1.z, a1.w, h.w);
// Normalise gradients
detail::tvec4<T, P> norm = taylorInvSqrt(detail::tvec4<T, P>(dot(p0, p0), dot(p1, p1), dot(p2, p2), dot(p3, p3)));
detail::tvec4<T, P> norm = detail::taylorInvSqrt(detail::tvec4<T, P>(dot(p0, p0), dot(p1, p1), dot(p2, p2), dot(p3, p3)));
p0 *= norm.x;
p1 *= norm.y;
p2 *= norm.z;
@ -885,8 +789,8 @@ namespace glm
// Permutations
i = mod(i, T(289));
T j0 = permute(permute(permute(permute(i.w) + i.z) + i.y) + i.x);
detail::tvec4<T, P> j1 = permute(permute(permute(permute(
T j0 = detail::permute(detail::permute(detail::permute(detail::permute(i.w) + i.z) + i.y) + i.x);
detail::tvec4<T, P> j1 = detail::permute(detail::permute(detail::permute(detail::permute(
i.w + detail::tvec4<T, P>(i1.w, i2.w, i3.w, T(1)))
+ i.z + detail::tvec4<T, P>(i1.z, i2.z, i3.z, T(1)))
+ i.y + detail::tvec4<T, P>(i1.y, i2.y, i3.y, T(1)))
@ -896,19 +800,19 @@ namespace glm
// 7*7*6 = 294, which is close to the ring size 17*17 = 289.
detail::tvec4<T, P> ip = detail::tvec4<T, P>(T(1) / T(294), T(1) / T(49), T(1) / T(7), T(0));
detail::tvec4<T, P> p0 = grad4(j0, ip);
detail::tvec4<T, P> p1 = grad4(j1.x, ip);
detail::tvec4<T, P> p2 = grad4(j1.y, ip);
detail::tvec4<T, P> p3 = grad4(j1.z, ip);
detail::tvec4<T, P> p4 = grad4(j1.w, ip);
detail::tvec4<T, P> p0 = detail::grad4(j0, ip);
detail::tvec4<T, P> p1 = detail::grad4(j1.x, ip);
detail::tvec4<T, P> p2 = detail::grad4(j1.y, ip);
detail::tvec4<T, P> p3 = detail::grad4(j1.z, ip);
detail::tvec4<T, P> p4 = detail::grad4(j1.w, ip);
// Normalise gradients
detail::tvec4<T, P> norm = taylorInvSqrt(detail::tvec4<T, P>(dot(p0, p0), dot(p1, p1), dot(p2, p2), dot(p3, p3)));
detail::tvec4<T, P> norm = detail::taylorInvSqrt(detail::tvec4<T, P>(dot(p0, p0), dot(p1, p1), dot(p2, p2), dot(p3, p3)));
p0 *= norm.x;
p1 *= norm.y;
p2 *= norm.z;
p3 *= norm.w;
p4 *= taylorInvSqrt(dot(p4, p4));
p4 *= detail::taylorInvSqrt(dot(p4, p4));
// Mix contributions from the five corners
detail::tvec3<T, P> m0 = max(T(0.6) - detail::tvec3<T, P>(dot(x0, x0), dot(x1, x1), dot(x2, x2)), T(0));

View File

@ -40,7 +40,7 @@
#define GLM_GTC_packing
// Dependency:
#include "../glm.hpp"
#include "type_precision.hpp"
#if(defined(GLM_MESSAGES) && !defined(GLM_EXT_INCLUDED))
# pragma message("GLM: GLM_GTC_packing extension included")

View File

@ -26,6 +26,12 @@
/// @author Christophe Riccio
///////////////////////////////////////////////////////////////////////////////////
#include "../common.hpp"
#include "../vec2.hpp"
#include "../vec3.hpp"
#include "../vec4.hpp"
#include "../detail/type_half.hpp"
namespace glm{
namespace detail
{
@ -42,9 +48,9 @@ namespace detail
// 0x7f800000 => 01111111 10000000 00000000 00000000
// 0x00008000 => 00000000 00000000 10000000 00000000
return
((f >> 16) & 0x8000) | // sign
((((f & 0x7f800000) - 0x38000000) >> 13) & 0x7c00) | // exponential
((f >> 13) & 0x03ff); // Mantissa
((f >> 16) & 0x8000) | // sign
((((f & 0x7f800000) - 0x38000000) >> 13) & 0x7c00) | // exponential
((f >> 13) & 0x03ff); // Mantissa
}
GLM_FUNC_QUALIFIER glm::uint32 float2packed11(glm::uint32 const & f)

View File

@ -41,7 +41,10 @@
#define GLM_GTC_quaternion
// Dependency:
#include "../glm.hpp"
#include "../mat3x3.hpp"
#include "../mat4x4.hpp"
#include "../vec3.hpp"
#include "../vec4.hpp"
#include "../gtc/constants.hpp"
#if(defined(GLM_MESSAGES) && !defined(GLM_EXT_INCLUDED))
@ -61,7 +64,7 @@ namespace detail
public:
T x, y, z, w;
GLM_FUNC_DECL GLM_CONSTEXPR int length() const;
GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const;
// Constructors
GLM_FUNC_DECL tquat();
@ -102,12 +105,12 @@ namespace detail
tmat4x4<T, P> const & m);
// Accesses
GLM_FUNC_DECL T & operator[](int i);
GLM_FUNC_DECL T const & operator[](int i) const;
GLM_FUNC_DECL T & operator[](length_t i);
GLM_FUNC_DECL T const & operator[](length_t i) const;
// Operators
GLM_FUNC_DECL tquat<T, P> & operator+=(tquat<T, P> const & q);
GLM_FUNC_DECL tquat<T, P> & operator*=(tquat<T, P> const & q);
GLM_FUNC_DECL tquat<T, P> & operator+=(tquat<T, P> const & q);
GLM_FUNC_DECL tquat<T, P> & operator*=(tquat<T, P> const & q);
GLM_FUNC_DECL tquat<T, P> & operator*=(T const & s);
GLM_FUNC_DECL tquat<T, P> & operator/=(T const & s);
};

View File

@ -26,13 +26,16 @@
/// @author Christophe Riccio
///////////////////////////////////////////////////////////////////////////////////
#include "../trigonometric.hpp"
#include "../geometric.hpp"
#include "../exponential.hpp"
#include <limits>
namespace glm{
namespace detail
{
template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR int tquat<T, P>::length() const
GLM_FUNC_QUALIFIER GLM_CONSTEXPR length_t tquat<T, P>::length() const
{
return 4;
}
@ -166,14 +169,14 @@ namespace detail
// tquat<T, P> accesses
template <typename T, precision P>
GLM_FUNC_QUALIFIER T & tquat<T, P>::operator[] (int i)
GLM_FUNC_QUALIFIER T & tquat<T, P>::operator[] (length_t i)
{
assert(i >= 0 && i < this->length());
return (&x)[i];
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER T const & tquat<T, P>::operator[] (int i) const
template <typename T, precision P>
GLM_FUNC_QUALIFIER T const & tquat<T, P>::operator[] (length_t i) const
{
assert(i >= 0 && i < this->length());
return (&x)[i];
@ -182,34 +185,34 @@ namespace detail
//////////////////////////////////////////////////////////////
// tquat<valType> operators
template <typename T, precision P>
GLM_FUNC_QUALIFIER tquat<T, P> & tquat<T, P>::operator +=
(
tquat<T, P> const & q
)
{
this->w += q.w;
template <typename T, precision P>
GLM_FUNC_QUALIFIER tquat<T, P> & tquat<T, P>::operator +=
(
tquat<T, P> const & q
)
{
this->w += q.w;
this->x += q.x;
this->y += q.y;
this->z += q.z;
return *this;
}
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tquat<T, P> & tquat<T, P>::operator *=
(
tquat<T, P> const & q
)
{
tquat<T, P> const p(*this);
this->w = p.w * q.w - p.x * q.x - p.y * q.y - p.z * q.z;
template <typename T, precision P>
GLM_FUNC_QUALIFIER tquat<T, P> & tquat<T, P>::operator *=
(
tquat<T, P> const & q
)
{
tquat<T, P> const p(*this);
this->w = p.w * q.w - p.x * q.x - p.y * q.y - p.z * q.z;
this->x = p.w * q.x + p.x * q.w + p.y * q.z - p.z * q.y;
this->y = p.w * q.y + p.y * q.w + p.z * q.x - p.x * q.z;
this->z = p.w * q.z + p.z * q.w + p.x * q.y - p.y * q.x;
return *this;
}
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tquat<T, P> & tquat<T, P>::operator *=
(
@ -222,7 +225,7 @@ namespace detail
this->z *= s;
return *this;
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tquat<T, P> & tquat<T, P>::operator /=
(

View File

@ -41,7 +41,8 @@
#define GLM_GTC_random
// Dependency:
#include "../glm.hpp"
#include "../vec2.hpp"
#include "../vec3.hpp"
#if(defined(GLM_MESSAGES) && !defined(GLM_EXT_INCLUDED))
# pragma message("GLM: GLM_GTC_random extension included")

View File

@ -26,6 +26,8 @@
/// @author Christophe Riccio
///////////////////////////////////////////////////////////////////////////////////
#include "../geometric.hpp"
#include "../exponential.hpp"
#include <cstdlib>
#include <ctime>
#include <cassert>
@ -67,7 +69,7 @@ namespace detail
template <typename genType>
GLM_FUNC_QUALIFIER genType linearRand
(
genType const & Min,
genType const & Min,
genType const & Max
)
{

View File

@ -38,8 +38,8 @@
#ifndef GLM_GTC_reciprocal
#define GLM_GTC_reciprocal
// Dependency:
#include "../glm.hpp"
// Dependencies
#include "../detail/setup.hpp"
#if(defined(GLM_MESSAGES) && !defined(GLM_EXT_INCLUDED))
# pragma message("GLM: GLM_GTC_reciprocal extension included")

View File

@ -26,6 +26,9 @@
/// @author Christophe Riccio
///////////////////////////////////////////////////////////////////////////////////
#include "../trigonometric.hpp"
#include <limits>
namespace glm
{
// sec

View File

@ -44,8 +44,19 @@
#define GLM_GTC_type_precision
// Dependency:
#include "../glm.hpp"
#include "../gtc/quaternion.hpp"
#include "../vec2.hpp"
#include "../vec3.hpp"
#include "../vec4.hpp"
#include "../mat2x2.hpp"
#include "../mat2x3.hpp"
#include "../mat2x4.hpp"
#include "../mat3x2.hpp"
#include "../mat3x3.hpp"
#include "../mat3x4.hpp"
#include "../mat4x2.hpp"
#include "../mat4x3.hpp"
#include "../mat4x4.hpp"
#if(defined(GLM_MESSAGES) && !defined(GLM_EXT_INCLUDED))
# pragma message("GLM: GLM_GTC_type_precision extension included")

View File

@ -60,8 +60,19 @@
#define GLM_GTC_type_ptr
// Dependency:
#include "../glm.hpp"
#include "../gtc/quaternion.hpp"
#include "../vec2.hpp"
#include "../vec3.hpp"
#include "../vec4.hpp"
#include "../mat2x2.hpp"
#include "../mat2x3.hpp"
#include "../mat2x4.hpp"
#include "../mat3x2.hpp"
#include "../mat3x3.hpp"
#include "../mat3x4.hpp"
#include "../mat4x2.hpp"
#include "../mat4x3.hpp"
#include "../mat4x4.hpp"
#include <cstring>
#if(defined(GLM_MESSAGES) && !defined(GLM_EXT_INCLUDED))

View File

@ -39,8 +39,8 @@
#ifndef GLM_GTC_ulp
#define GLM_GTC_ulp
// Dependency:
#include "../glm.hpp"
// Dependencies
#include "../detail/setup.hpp"
#if(defined(GLM_MESSAGES) && !defined(GLM_EXT_INCLUDED))
# pragma message("GLM: GLM_GTC_ulp extension included")

View File

@ -33,6 +33,7 @@
/// is preserved.
///////////////////////////////////////////////////////////////////////////////////
#include "../detail/type_int.hpp"
#include <cmath>
#include <cfloat>
@ -212,11 +213,11 @@ namespace glm
return GLM_NEXT_AFTER_DBL(x, std::numeric_limits<double>::max());
}
template<typename T, template<typename> class vecType>
GLM_FUNC_QUALIFIER vecType<T> next_float(vecType<T> const & x)
template<typename T, precision P, template<typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> next_float(vecType<T, P> const & x)
{
vecType<T> Result;
for(std::size_t i = 0; i < Result.length(); ++i)
vecType<T, P> Result;
for(length_t i = 0; i < Result.length(); ++i)
Result[i] = next_float(x[i]);
return Result;
}
@ -231,11 +232,11 @@ namespace glm
return GLM_NEXT_AFTER_DBL(x, std::numeric_limits<double>::min());
}
template<typename T, template<typename> class vecType>
GLM_FUNC_QUALIFIER vecType<T> prev_float(vecType<T> const & x)
template<typename T, precision P, template<typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> prev_float(vecType<T, P> const & x)
{
vecType<T> Result;
for(std::size_t i = 0; i < Result.length(); ++i)
vecType<T, P> Result;
for(length_t i = 0; i < Result.length(); ++i)
Result[i] = prev_float(x[i]);
return Result;
}
@ -244,16 +245,16 @@ namespace glm
GLM_FUNC_QUALIFIER T next_float(T const & x, uint const & ulps)
{
T temp = x;
for(std::size_t i = 0; i < ulps; ++i)
for(length_t i = 0; i < ulps; ++i)
temp = next_float(temp);
return temp;
}
template<typename T, template<typename> class vecType>
GLM_FUNC_QUALIFIER vecType<T> next_float(vecType<T> const & x, vecType<uint> const & ulps)
template<typename T, precision P, template<typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> next_float(vecType<T, P> const & x, vecType<uint, P> const & ulps)
{
vecType<T> Result;
for(std::size_t i = 0; i < Result.length(); ++i)
vecType<T, P> Result;
for(length_t i = 0; i < Result.length(); ++i)
Result[i] = next_float(x[i], ulps[i]);
return Result;
}
@ -262,16 +263,16 @@ namespace glm
GLM_FUNC_QUALIFIER T prev_float(T const & x, uint const & ulps)
{
T temp = x;
for(std::size_t i = 0; i < ulps; ++i)
for(length_t i = 0; i < ulps; ++i)
temp = prev_float(temp);
return temp;
}
template<typename T, template<typename> class vecType>
GLM_FUNC_QUALIFIER vecType<T> prev_float(vecType<T> const & x, vecType<uint> const & ulps)
template<typename T, precision P, template<typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> prev_float(vecType<T, P> const & x, vecType<uint, P> const & ulps)
{
vecType<T> Result;
for(std::size_t i = 0; i < Result.length(); ++i)
vecType<T, P> Result;
for(length_t i = 0; i < Result.length(); ++i)
Result[i] = prev_float(x[i], ulps[i]);
return Result;
}
@ -307,11 +308,11 @@ namespace glm
return ulp;
}
template<typename T, template<typename> class vecType>
GLM_FUNC_QUALIFIER vecType<uint> float_distance(vecType<T> const & x, vecType<T> const & y)
template<typename T, precision P, template<typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<uint, P> float_distance(vecType<T, P> const & x, vecType<T, P> const & y)
{
vecType<uint> Result;
for(std::size_t i = 0; i < Result.length(); ++i)
vecType<uint, P> Result;
for(length_t i = 0; i < Result.length(); ++i)
Result[i] = float_distance(x[i], y[i]);
return Result;
}

View File

@ -26,6 +26,7 @@
/// @author Maksim Vorobiev (msomeone@gmail.com)
///////////////////////////////////////////////////////////////////////////////////
#include "../geometric.hpp"
#include <limits>
namespace glm{

View File

@ -7,6 +7,7 @@
// File : glm/gtx/intersect.inl
///////////////////////////////////////////////////////////////////////////////////////////////////
#include "../geometric.hpp"
#include <cfloat>
#include <limits>

View File

@ -9,11 +9,11 @@
namespace glm
{
template <typename T, precision P>
template <typename T, precision P>
GLM_FUNC_QUALIFIER T mixedProduct
(
detail::tvec3<T, P> const & v1,
detail::tvec3<T, P> const & v2,
detail::tvec3<T, P> const & v1,
detail::tvec3<T, P> const & v2,
detail::tvec3<T, P> const & v3
)
{

View File

@ -8,6 +8,7 @@
///////////////////////////////////////////////////////////////////////////////////////////////////
#include <glm/gtc/epsilon.hpp>
#include <glm/matrix.hpp>
#include <glm/vector_relational.hpp>
#include <glm/mat2x2.hpp>
#include <vector>

View File

@ -7,8 +7,10 @@
// File : test/core/type_mat3x3.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#include <glm/mat3x3.hpp>
#include <glm/gtc/epsilon.hpp>
#include <glm/matrix.hpp>
#include <glm/vector_relational.hpp>
#include <glm/mat3x3.hpp>
#include <cstdio>
#include <vector>

View File

@ -7,8 +7,9 @@
// File : test/core/type_mat4x4.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#include <glm/mat4x4.hpp>
#include <glm/gtc/epsilon.hpp>
#include <glm/matrix.hpp>
#include <glm/mat4x4.hpp>
#include <cstdio>
#include <vector>