Merge pull request #6 from g-truc/master

sync merge
This commit is contained in:
Thom de Villa 2015-10-13 17:06:37 +02:00
commit 21c0228264
102 changed files with 3216 additions and 1830 deletions

5
.gitignore vendored
View File

@ -30,7 +30,6 @@
# CMake
CMakeCache.txt
CMakeFiles
Makefile
cmake_install.cmake
install_manifest.txt
*.cmake
@ -43,5 +42,9 @@ Testing/*
test/gtc/*.dds
# Project Files
Makefile
*.cbp
*.user
# Misc.
*.log

Binary file not shown.

Binary file not shown.

View File

@ -51,7 +51,7 @@ PROJECT_BRIEF =
# pixels and the maximum width should not exceed 200 pixels. Doxygen will copy
# the logo to the output directory.
PROJECT_LOGO = E:/Source/G-Truc/glm/doc/logo.png
PROJECT_LOGO = D:/Source/G-Truc/glm/doc/logo.png
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path
# into which the generated documentation will be written. If a relative path is

View File

@ -86,7 +86,7 @@ namespace detail
template <typename genType>
GLM_FUNC_QUALIFIER genType length(genType x)
{
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'length' only accept floating-point inputs");
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'length' accepts only floating-point inputs");
return abs(x);
}
@ -94,7 +94,7 @@ namespace detail
template <typename T, precision P, template <typename, precision> class vecType>
GLM_FUNC_QUALIFIER T length(vecType<T, P> const & v)
{
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'length' only accept floating-point inputs");
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'length' accepts only floating-point inputs");
return sqrt(dot(v, v));
}
@ -103,7 +103,7 @@ namespace detail
template <typename genType>
GLM_FUNC_QUALIFIER genType distance(genType const & p0, genType const & p1)
{
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'distance' only accept floating-point inputs");
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'distance' accepts only floating-point inputs");
return length(p1 - p0);
}
@ -118,14 +118,14 @@ namespace detail
template <typename T>
GLM_FUNC_QUALIFIER T dot(T x, T y)
{
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'dot' only accept floating-point inputs");
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'dot' accepts only floating-point inputs");
return x * y;
}
template <typename T, precision P, template <typename, precision> class vecType>
GLM_FUNC_QUALIFIER T dot(vecType<T, P> const & x, vecType<T, P> const & y)
{
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'dot' only accept floating-point inputs");
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'dot' accepts only floating-point inputs");
return detail::compute_dot<vecType, T, P>::call(x, y);
}
@ -133,7 +133,7 @@ namespace detail
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec3<T, P> cross(tvec3<T, P> const & x, tvec3<T, P> const & y)
{
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'cross' only accept floating-point inputs");
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'cross' accepts only floating-point inputs");
return tvec3<T, P>(
x.y * y.z - y.y * x.z,
@ -145,7 +145,7 @@ namespace detail
template <typename genType>
GLM_FUNC_QUALIFIER genType normalize(genType const & x)
{
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'normalize' only accept floating-point inputs");
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'normalize' accepts only floating-point inputs");
return x < genType(0) ? genType(-1) : genType(1);
}
@ -153,7 +153,7 @@ namespace detail
template <typename T, precision P, template <typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> normalize(vecType<T, P> const & x)
{
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'normalize' only accept floating-point inputs");
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'normalize' accepts only floating-point inputs");
return x * inversesqrt(dot(x, x));
}
@ -182,7 +182,7 @@ namespace detail
template <typename genType>
GLM_FUNC_QUALIFIER genType refract(genType const & I, genType const & N, genType const & eta)
{
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'refract' only accept floating-point inputs");
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'refract' accepts only floating-point inputs");
genType const dotValue(dot(N, I));
genType const k(static_cast<genType>(1) - eta * eta * (static_cast<genType>(1) - dotValue * dotValue));
@ -192,7 +192,7 @@ namespace detail
template <typename T, precision P, template <typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> refract(vecType<T, P> const & I, vecType<T, P> const & N, T eta)
{
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'refract' only accept floating-point inputs");
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'refract' accepts only floating-point inputs");
T const dotValue(dot(N, I));
T const k(static_cast<T>(1) - eta * eta * (static_cast<T>(1) - dotValue * dotValue));

View File

@ -1,93 +0,0 @@
///////////////////////////////////////////////////////////////////////////////////
/// OpenGL Mathematics (glm.g-truc.net)
///
/// Copyright (c) 2005 - 2015 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.
///
/// Restrictions:
/// By making use of the Software for military purposes, you choose to make
/// a Bunny unhappy.
///
/// 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/func_noise.hpp
/// @date 2008-08-01 / 2011-06-18
/// @author Christophe Riccio
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.13 Noise Functions</a>
///
/// @defgroup core_func_noise Noise functions
/// @ingroup core
///
/// Noise functions are stochastic functions that can be used to increase visual
/// complexity. Values returned by the following noise functions give the
/// appearance of randomness, but are not truly random.
///////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "type_vec1.hpp"
#include "type_vec2.hpp"
#include "type_vec3.hpp"
#include "setup.hpp"
namespace glm
{
/// @addtogroup core_func_noise
/// @{
/// Returns a 1D noise value based on the input value x.
///
/// @tparam genType Floating-point scalar or vector types.
///
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/noise1.xml">GLSL noise1 man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.13 Noise Functions</a>
template <typename genType>
GLM_FUNC_DECL typename genType::value_type noise1(genType const & x);
/// Returns a 2D noise value based on the input value x.
///
/// @tparam genType Floating-point scalar or vector types.
///
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/noise2.xml">GLSL noise2 man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.13 Noise Functions</a>
template <typename genType>
GLM_FUNC_DECL tvec2<typename genType::value_type, defaultp> noise2(genType const & x);
/// Returns a 3D noise value based on the input value x.
///
/// @tparam genType Floating-point scalar or vector types.
///
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/noise3.xml">GLSL noise3 man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.13 Noise Functions</a>
template <typename genType>
GLM_FUNC_DECL tvec3<typename genType::value_type, defaultp> noise3(genType const & x);
/// Returns a 4D noise value based on the input value x.
///
/// @tparam genType Floating-point scalar or vector types.
///
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/noise4.xml">GLSL noise4 man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.13 Noise Functions</a>
template <typename genType>
GLM_FUNC_DECL tvec4<typename genType::value_type, defaultp> noise4(genType const & x);
/// @}
}//namespace glm
#include "func_noise.inl"

View File

@ -1,388 +0,0 @@
///////////////////////////////////////////////////////////////////////////////////
/// OpenGL Mathematics (glm.g-truc.net)
///
/// Copyright (c) 2005 - 2015 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.
///
/// Restrictions:
/// By making use of the Software for military purposes, you choose to make
/// a Bunny unhappy.
///
/// 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/func_noise.inl
/// @date 2008-08-01 / 2011-09-27
/// @author Christophe Riccio
///////////////////////////////////////////////////////////////////////////////////
#include "../detail/_noise.hpp"
#include "./func_common.hpp"
namespace glm{
namespace detail
{
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec4<T, P> grad4(T const & j, tvec4<T, P> const & ip)
{
tvec3<T, P> pXYZ = floor(fract(tvec3<T, P>(j) * tvec3<T, P>(ip)) * T(7)) * ip[2] - T(1);
T pW = static_cast<T>(1.5) - dot(abs(pXYZ), tvec3<T, P>(1));
tvec4<T, P> s = tvec4<T, P>(lessThan(tvec4<T, P>(pXYZ, pW), tvec4<T, P>(0.0)));
pXYZ = pXYZ + (tvec3<T, P>(s) * T(2) - T(1)) * s.w;
return tvec4<T, P>(pXYZ, pW);
}
}//namespace detail
template <typename T>
GLM_FUNC_QUALIFIER T noise1(T const & x)
{
return noise1(tvec2<T, defaultp>(x, T(0)));
}
template <typename T>
GLM_FUNC_QUALIFIER tvec2<T, defaultp> noise2(T const & x)
{
return tvec2<T, defaultp>(
noise1(x + T(0.0)),
noise1(x + T(1.0)));
}
template <typename T>
GLM_FUNC_QUALIFIER tvec3<T, defaultp> noise3(T const & x)
{
return tvec3<T, defaultp>(
noise1(x - T(1.0)),
noise1(x + T(0.0)),
noise1(x + T(1.0)));
}
template <typename T>
GLM_FUNC_QUALIFIER tvec4<T, defaultp> noise4(T const & x)
{
return tvec4<T, defaultp>(
noise1(x - T(1.0)),
noise1(x + T(0.0)),
noise1(x + T(1.0)),
noise1(x + T(2.0)));
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER T noise1(tvec2<T, P> const & v)
{
tvec4<T, P> const C = tvec4<T, P>(
T( 0.211324865405187), // (3.0 - sqrt(3.0)) / 6.0
T( 0.366025403784439), // 0.5 * (sqrt(3.0) - 1.0)
T(-0.577350269189626), // -1.0 + 2.0 * C.x
T( 0.024390243902439)); // 1.0 / 41.0
// First corner
tvec2<T, P> i = floor(v + dot(v, tvec2<T, P>(C[1])));
tvec2<T, P> x0 = v - i + dot(i, tvec2<T, P>(C[0]));
// Other corners
//i1.x = step( x0.y, x0.x ); // x0.x > x0.y ? 1.0 : 0.0
//i1.y = 1.0 - i1.x;
tvec2<T, P> i1 = (x0.x > x0.y) ? tvec2<T, P>(1, 0) : tvec2<T, P>(0, 1);
// x0 = x0 - 0.0 + 0.0 * C.xx ;
// x1 = x0 - i1 + 1.0 * C.xx ;
// x2 = x0 - 1.0 + 2.0 * C.xx ;
tvec4<T, P> x12 = tvec4<T, P>(x0.x, x0.y, x0.x, x0.y) + tvec4<T, P>(C.x, C.x, C.z, C.z);
x12 = tvec4<T, P>(tvec2<T, P>(x12) - i1, x12.z, x12.w);
// Permutations
i = mod(i, T(289)); // Avoid truncation effects in permutation
tvec3<T, P> p = detail::permute(
detail::permute(i.y + tvec3<T, P>(T(0), i1.y, T(1))) + i.x + tvec3<T, P>(T(0), i1.x, T(1)));
tvec3<T, P> m = max(T(0.5) - tvec3<T, P>(
dot(x0, x0),
dot(tvec2<T, P>(x12.x, x12.y), tvec2<T, P>(x12.x, x12.y)),
dot(tvec2<T, P>(x12.z, x12.w), tvec2<T, P>(x12.z, x12.w))), T(0));
m = m * m;
m = m * m;
// Gradients: 41 points uniformly over a line, mapped onto a diamond.
// The ring size 17*17 = 289 is close to a multiple of 41 (41*7 = 287)
tvec3<T, P> x = static_cast<T>(2) * fract(p * C.w) - T(1);
tvec3<T, P> h = abs(x) - T(0.5);
tvec3<T, P> ox = floor(x + T(0.5));
tvec3<T, P> a0 = x - ox;
// Normalise gradients implicitly by scaling m
// Inlined for speed: m *= taylorInvSqrt( a0*a0 + h*h );
m *= static_cast<T>(1.79284291400159) - T(0.85373472095314) * (a0 * a0 + h * h);
// Compute final noise value at P
tvec3<T, P> g;
g.x = a0.x * x0.x + h.x * x0.y;
//g.yz = a0.yz * x12.xz + h.yz * x12.yw;
g.y = a0.y * x12.x + h.y * x12.y;
g.z = a0.z * x12.z + h.z * x12.w;
return T(130) * dot(m, g);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER T noise1(tvec3<T, P> const & v)
{
tvec2<T, P> const C(1.0 / 6.0, 1.0 / 3.0);
tvec4<T, P> const D(0.0, 0.5, 1.0, 2.0);
// First corner
tvec3<T, P> i(floor(v + dot(v, tvec3<T, P>(C.y))));
tvec3<T, P> x0(v - i + dot(i, tvec3<T, P>(C.x)));
// Other corners
tvec3<T, P> g(step(tvec3<T, P>(x0.y, x0.z, x0.x), x0));
tvec3<T, P> l(T(1) - g);
tvec3<T, P> i1(min(g, tvec3<T, P>(l.z, l.x, l.y)));
tvec3<T, P> i2(max(g, tvec3<T, P>(l.z, l.x, l.y)));
// x0 = x0 - 0.0 + 0.0 * C.xxx;
// x1 = x0 - i1 + 1.0 * C.xxx;
// x2 = x0 - i2 + 2.0 * C.xxx;
// x3 = x0 - 1.0 + 3.0 * C.xxx;
tvec3<T, P> x1(x0 - i1 + C.x);
tvec3<T, P> x2(x0 - i2 + C.y); // 2.0*C.x = 1/3 = C.y
tvec3<T, P> x3(x0 - D.y); // -1.0+3.0*C.x = -0.5 = -D.y
// Permutations
i = mod289(i);
tvec4<T, P> p(detail::permute(detail::permute(detail::permute(
i.z + tvec4<T, P>(T(0), i1.z, i2.z, T(1))) +
i.y + tvec4<T, P>(T(0), i1.y, i2.y, T(1))) +
i.x + tvec4<T, P>(T(0), i1.x, i2.x, T(1))));
// Gradients: 7x7 points over a square, mapped onto an octahedron.
// The ring size 17*17 = 289 is close to a multiple of 49 (49*6 = 294)
T n_ = static_cast<T>(0.142857142857); // 1.0/7.0
tvec3<T, P> ns(n_ * tvec3<T, P>(D.w, D.y, D.z) - tvec3<T, P>(D.x, D.z, D.x));
tvec4<T, P> j(p - T(49) * floor(p * ns.z * ns.z)); // mod(p,7*7)
tvec4<T, P> x_(floor(j * ns.z));
tvec4<T, P> y_(floor(j - T(7) * x_)); // mod(j,N)
tvec4<T, P> x(x_ * ns.x + ns.y);
tvec4<T, P> y(y_ * ns.x + ns.y);
tvec4<T, P> h(T(1) - abs(x) - abs(y));
tvec4<T, P> b0(x.x, x.y, y.x, y.y);
tvec4<T, P> b1(x.z, x.w, y.z, y.w);
// vec4 s0 = vec4(lessThan(b0,0.0))*2.0 - 1.0;
// vec4 s1 = vec4(lessThan(b1,0.0))*2.0 - 1.0;
tvec4<T, P> s0(floor(b0) * T(2) + T(1));
tvec4<T, P> s1(floor(b1) * T(2) + T(1));
tvec4<T, P> sh(-step(h, tvec4<T, P>(0.0)));
tvec4<T, P> a0 = tvec4<T, P>(b0.x, b0.z, b0.y, b0.w) + tvec4<T, P>(s0.x, s0.z, s0.y, s0.w) * tvec4<T, P>(sh.x, sh.x, sh.y, sh.y);
tvec4<T, P> a1 = tvec4<T, P>(b1.x, b1.z, b1.y, b1.w) + tvec4<T, P>(s1.x, s1.z, s1.y, s1.w) * tvec4<T, P>(sh.z, sh.z, sh.w, sh.w);
tvec3<T, P> p0(a0.x, a0.y, h.x);
tvec3<T, P> p1(a0.z, a0.w, h.y);
tvec3<T, P> p2(a1.x, a1.y, h.z);
tvec3<T, P> p3(a1.z, a1.w, h.w);
// Normalise gradients
tvec4<T, P> norm = taylorInvSqrt(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;
// Mix final noise value
tvec4<T, P> m = max(T(0.6) - tvec4<T, P>(dot(x0, x0), dot(x1, x1), dot(x2, x2), dot(x3, x3)), T(0));
m = m * m;
return T(42) * dot(m * m, tvec4<T, P>(dot(p0, x0), dot(p1, x1), dot(p2, x2), dot(p3, x3)));
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER T noise1(tvec4<T, P> const & v)
{
tvec4<T, P> const C(
0.138196601125011, // (5 - sqrt(5))/20 G4
0.276393202250021, // 2 * G4
0.414589803375032, // 3 * G4
-0.447213595499958); // -1 + 4 * G4
// (sqrt(5) - 1)/4 = F4, used once below
T const F4 = static_cast<T>(0.309016994374947451);
// First corner
tvec4<T, P> i = floor(v + dot(v, tvec4<T, P>(F4)));
tvec4<T, P> x0 = v - i + dot(i, tvec4<T, P>(C.x));
// Other corners
// Rank sorting originally contributed by Bill Licea-Kane, AMD (formerly ATI)
tvec4<T, P> i0;
tvec3<T, P> isX = step(tvec3<T, P>(x0.y, x0.z, x0.w), tvec3<T, P>(x0.x));
tvec3<T, P> isYZ = step(tvec3<T, P>(x0.z, x0.w, x0.w), tvec3<T, P>(x0.y, x0.y, x0.z));
// i0.x = dot(isX, vec3(1.0));
//i0.x = isX.x + isX.y + isX.z;
//i0.yzw = static_cast<T>(1) - isX;
i0 = tvec4<T, P>(isX.x + isX.y + isX.z, T(1) - isX);
// i0.y += dot(isYZ.xy, vec2(1.0));
i0.y += isYZ.x + isYZ.y;
//i0.zw += 1.0 - tvec2<T, P>(isYZ.x, isYZ.y);
i0.z += static_cast<T>(1) - isYZ.x;
i0.w += static_cast<T>(1) - isYZ.y;
i0.z += isYZ.z;
i0.w += static_cast<T>(1) - isYZ.z;
// i0 now contains the unique values 0,1,2,3 in each channel
tvec4<T, P> i3 = clamp(i0, T(0), T(1));
tvec4<T, P> i2 = clamp(i0 - T(1), T(0), T(1));
tvec4<T, P> i1 = clamp(i0 - T(2), T(0), T(1));
// x0 = x0 - 0.0 + 0.0 * C.xxxx
// x1 = x0 - i1 + 0.0 * C.xxxx
// x2 = x0 - i2 + 0.0 * C.xxxx
// x3 = x0 - i3 + 0.0 * C.xxxx
// x4 = x0 - 1.0 + 4.0 * C.xxxx
tvec4<T, P> x1 = x0 - i1 + C.x;
tvec4<T, P> x2 = x0 - i2 + C.y;
tvec4<T, P> x3 = x0 - i3 + C.z;
tvec4<T, P> x4 = x0 + C.w;
// Permutations
i = mod(i, T(289));
T j0 = detail::permute(detail::permute(detail::permute(detail::permute(i.w) + i.z) + i.y) + i.x);
tvec4<T, P> j1 = detail::permute(detail::permute(detail::permute(detail::permute(
i.w + tvec4<T, P>(i1.w, i2.w, i3.w, T(1))) +
i.z + tvec4<T, P>(i1.z, i2.z, i3.z, T(1))) +
i.y + tvec4<T, P>(i1.y, i2.y, i3.y, T(1))) +
i.x + tvec4<T, P>(i1.x, i2.x, i3.x, T(1)));
// Gradients: 7x7x6 points over a cube, mapped onto a 4-cross polytope
// 7*7*6 = 294, which is close to the ring size 17*17 = 289.
tvec4<T, P> ip = tvec4<T, P>(T(1) / T(294), T(1) / T(49), T(1) / T(7), T(0));
tvec4<T, P> p0 = detail::grad4(j0, ip);
tvec4<T, P> p1 = detail::grad4(j1.x, ip);
tvec4<T, P> p2 = detail::grad4(j1.y, ip);
tvec4<T, P> p3 = detail::grad4(j1.z, ip);
tvec4<T, P> p4 = detail::grad4(j1.w, ip);
// Normalise gradients
tvec4<T, P> norm = detail::taylorInvSqrt(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));
// Mix contributions from the five corners
tvec3<T, P> m0 = max(T(0.6) - tvec3<T, P>(dot(x0, x0), dot(x1, x1), dot(x2, x2)), T(0));
tvec2<T, P> m1 = max(T(0.6) - tvec2<T, P>(dot(x3, x3), dot(x4, x4) ), T(0));
m0 = m0 * m0;
m1 = m1 * m1;
return T(49) * (
dot(m0 * m0, tvec3<T, P>(dot(p0, x0), dot(p1, x1), dot(p2, x2))) +
dot(m1 * m1, tvec2<T, P>(dot(p3, x3), dot(p4, x4))));
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec2<T, P> noise2(tvec2<T, P> const & x)
{
return tvec2<T, P>(
noise1(x + tvec2<T, P>(0.0)),
noise1(tvec2<T, P>(0.0) - x));
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec2<T, P> noise2(tvec3<T, P> const & x)
{
return tvec2<T, P>(
noise1(x + tvec3<T, P>(0.0)),
noise1(tvec3<T, P>(0.0) - x));
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec2<T, P> noise2(tvec4<T, P> const & x)
{
return tvec2<T, P>(
noise1(x + tvec4<T, P>(0)),
noise1(tvec4<T, P>(0) - x));
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec3<T, P> noise3(tvec2<T, P> const & x)
{
return tvec3<T, P>(
noise1(x - tvec2<T, P>(1.0)),
noise1(x + tvec2<T, P>(0.0)),
noise1(x + tvec2<T, P>(1.0)));
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec3<T, P> noise3(tvec3<T, P> const & x)
{
return tvec3<T, P>(
noise1(x - tvec3<T, P>(1.0)),
noise1(x + tvec3<T, P>(0.0)),
noise1(x + tvec3<T, P>(1.0)));
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec3<T, P> noise3(tvec4<T, P> const & x)
{
return tvec3<T, P>(
noise1(x - tvec4<T, P>(1)),
noise1(x + tvec4<T, P>(0)),
noise1(x + tvec4<T, P>(1)));
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec4<T, P> noise4(tvec2<T, P> const & x)
{
return tvec4<T, P>(
noise1(x - tvec2<T, P>(1)),
noise1(x + tvec2<T, P>(0)),
noise1(x + tvec2<T, P>(1)),
noise1(x + tvec2<T, P>(2)));
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec4<T, P> noise4(tvec3<T, P> const & x)
{
return tvec4<T, P>(
noise1(x - tvec3<T, P>(1)),
noise1(x + tvec3<T, P>(0)),
noise1(x + tvec3<T, P>(1)),
noise1(x + tvec3<T, P>(2)));
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec4<T, P> noise4(tvec4<T, P> const & x)
{
return tvec4<T, P>(
noise1(x - tvec4<T, P>(1)),
noise1(x + tvec4<T, P>(0)),
noise1(x + tvec4<T, P>(1)),
noise1(x + tvec4<T, P>(2)));
}
}//namespace glm

View File

@ -58,7 +58,7 @@ namespace glm
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/radians.xml">GLSL radians man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions</a>
template <typename T, precision P, template <typename, precision> class vecType>
GLM_FUNC_DECL vecType<T, P> radians(vecType<T, P> const & degrees);
GLM_FUNC_DECL GLM_CONSTEXPR vecType<T, P> radians(vecType<T, P> const & degrees);
/// Converts radians to degrees and returns the result.
///
@ -67,7 +67,7 @@ namespace glm
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/degrees.xml">GLSL degrees man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions</a>
template <typename T, precision P, template <typename, precision> class vecType>
GLM_FUNC_DECL vecType<T, P> degrees(vecType<T, P> const & radians);
GLM_FUNC_DECL GLM_CONSTEXPR vecType<T, P> degrees(vecType<T, P> const & radians);
/// The standard trigonometric sine function.
/// The values returned by this function will range from [-1, 1].

View File

@ -38,7 +38,7 @@ namespace glm
{
// radians
template <typename genType>
GLM_FUNC_QUALIFIER genType radians(genType degrees)
GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType radians(genType degrees)
{
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'radians' only accept floating-point input");
@ -46,14 +46,14 @@ namespace glm
}
template <typename T, precision P, template <typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> radians(vecType<T, P> const & v)
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vecType<T, P> radians(vecType<T, P> const & v)
{
return detail::functor1<T, T, P, vecType>::call(radians, v);
}
// degrees
template <typename genType>
GLM_FUNC_QUALIFIER genType degrees(genType radians)
GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType degrees(genType radians)
{
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'degrees' only accept floating-point input");
@ -61,7 +61,7 @@ namespace glm
}
template <typename T, precision P, template <typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> degrees(vecType<T, P> const & v)
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vecType<T, P> degrees(vecType<T, P> const & v)
{
return detail::functor1<T, T, P, vecType>::call(degrees, v);
}

View File

@ -39,6 +39,15 @@ namespace glm
highp,
mediump,
lowp,
simd,
defaultp = highp
};
template <typename T, precision P, template <typename, precision> class genType>
struct type
{
static bool const is_vec = false;
static bool const is_mat = false;
static bool const is_quat = false;
};
}//namespace glm

View File

@ -38,15 +38,15 @@
///////////////////////////////////////////////////////////////////////////////////
// Version
#define GLM_VERSION 97
#define GLM_VERSION 98
#define GLM_VERSION_MAJOR 0
#define GLM_VERSION_MINOR 9
#define GLM_VERSION_PATCH 7
#define GLM_VERSION_PATCH 8
#define GLM_VERSION_REVISION 0
#if(defined(GLM_MESSAGES) && !defined(GLM_MESSAGE_VERSION_DISPLAYED))
# define GLM_MESSAGE_VERSION_DISPLAYED
# pragma message ("GLM: version 0.9.7.0")
# pragma message ("GLM: version 0.9.8.0")
#endif//GLM_MESSAGE
///////////////////////////////////////////////////////////////////////////////////
@ -366,6 +366,121 @@
# endif//GLM_MODEL
#endif//GLM_MESSAGE
///////////////////////////////////////////////////////////////////////////////////
// Platform
// User defines: GLM_FORCE_PURE GLM_FORCE_SSE2 GLM_FORCE_SSE3 GLM_FORCE_AVX GLM_FORCE_AVX2
#define GLM_ARCH_PURE 0x0000
#define GLM_ARCH_ARM 0x0001
#define GLM_ARCH_X86 0x0002
#define GLM_ARCH_SSE2 0x0004
#define GLM_ARCH_SSE3 0x0008
#define GLM_ARCH_SSE4 0x0010
#define GLM_ARCH_AVX 0x0020
#define GLM_ARCH_AVX2 0x0040
#if defined(GLM_FORCE_PURE)
# define GLM_ARCH GLM_ARCH_PURE
#elif defined(GLM_FORCE_AVX2)
# define GLM_ARCH (GLM_ARCH_AVX2 | GLM_ARCH_AVX | GLM_ARCH_SSE4 | GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
#elif defined(GLM_FORCE_AVX)
# define GLM_ARCH (GLM_ARCH_AVX | GLM_ARCH_SSE4 | GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
#elif defined(GLM_FORCE_SSE4)
# define GLM_ARCH (GLM_ARCH_SSE4 | GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
#elif defined(GLM_FORCE_SSE3)
# define GLM_ARCH (GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
#elif defined(GLM_FORCE_SSE2)
# define GLM_ARCH (GLM_ARCH_SSE2)
#elif (GLM_COMPILER & (GLM_COMPILER_APPLE_CLANG | GLM_COMPILER_LLVM | GLM_COMPILER_GCC)) || ((GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_PLATFORM & GLM_PLATFORM_LINUX))
# if(__AVX2__)
# define GLM_ARCH (GLM_ARCH_AVX2 | GLM_ARCH_AVX | GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
# elif(__AVX__)
# define GLM_ARCH (GLM_ARCH_AVX | GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
# elif(__SSE3__)
# define GLM_ARCH (GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
# elif(__SSE2__)
# define GLM_ARCH (GLM_ARCH_SSE2)
# else
# define GLM_ARCH GLM_ARCH_PURE
# endif
#elif (GLM_COMPILER & GLM_COMPILER_VC) || ((GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_PLATFORM & GLM_PLATFORM_WINDOWS))
# if defined(_M_ARM_FP)
# define GLM_ARCH (GLM_ARCH_ARM)
# elif defined(__AVX2__)
# define GLM_ARCH (GLM_ARCH_AVX2 | GLM_ARCH_AVX | GLM_ARCH_SSE4 | GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
# elif defined(__AVX__)
# define GLM_ARCH (GLM_ARCH_AVX | GLM_ARCH_SSE4 | GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
# elif _M_IX86_FP == 2
# define GLM_ARCH (GLM_ARCH_SSE2)
# else
# define GLM_ARCH (GLM_ARCH_PURE)
# endif
#elif (GLM_COMPILER & GLM_COMPILER_GCC) && (defined(__i386__) || defined(__x86_64__))
# if defined(__AVX2__)
# define GLM_ARCH (GLM_ARCH_AVX2 | GLM_ARCH_AVX | GLM_ARCH_SSE4 | GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
# elif defined(__AVX__)
# define GLM_ARCH (GLM_ARCH_AVX | GLM_ARCH_SSE4 | GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
# elif defined(__SSE4_1__ )
# define GLM_ARCH (GLM_ARCH_SSE4 | GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
# elif defined(__SSE3__)
# define GLM_ARCH (GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
# elif defined(__SSE2__)
# define GLM_ARCH (GLM_ARCH_SSE2)
# else
# define GLM_ARCH (GLM_ARCH_PURE)
# endif
#else
# define GLM_ARCH GLM_ARCH_PURE
#endif
// With MinGW-W64, including intrinsic headers before intrin.h will produce some errors. The problem is
// that windows.h (and maybe other headers) will silently include intrin.h, which of course causes problems.
// To fix, we just explicitly include intrin.h here.
#if defined(__MINGW64__) && (GLM_ARCH != GLM_ARCH_PURE)
# include <intrin.h>
#endif
#if GLM_ARCH & GLM_ARCH_AVX2
# include <immintrin.h>
#endif//GLM_ARCH
#if GLM_ARCH & GLM_ARCH_AVX
# include <immintrin.h>
#endif//GLM_ARCH
#if GLM_ARCH & GLM_ARCH_SSE4
# include <smmintrin.h>
#endif//GLM_ARCH
#if GLM_ARCH & GLM_ARCH_SSE3
# include <pmmintrin.h>
#endif//GLM_ARCH
#if GLM_ARCH & GLM_ARCH_SSE2
# include <emmintrin.h>
# if(GLM_COMPILER == GLM_COMPILER_VC2005) // VC2005 is missing some intrinsics, workaround
inline float _mm_cvtss_f32(__m128 A) { return A.m128_f32[0]; }
inline __m128 _mm_castpd_ps(__m128d PD) { union { __m128 ps; __m128d pd; } c; c.pd = PD; return c.ps; }
inline __m128d _mm_castps_pd(__m128 PS) { union { __m128 ps; __m128d pd; } c; c.ps = PS; return c.pd; }
inline __m128i _mm_castps_si128(__m128 PS) { union { __m128 ps; __m128i pi; } c; c.ps = PS; return c.pi; }
inline __m128 _mm_castsi128_ps(__m128i PI) { union { __m128 ps; __m128i pi; } c; c.pi = PI; return c.ps; }
# endif
#endif//GLM_ARCH
#if defined(GLM_MESSAGES) && !defined(GLM_MESSAGE_ARCH_DISPLAYED)
# define GLM_MESSAGE_ARCH_DISPLAYED
# if(GLM_ARCH == GLM_ARCH_PURE)
# pragma message("GLM: Platform independent code")
# elif(GLM_ARCH & GLM_ARCH_ARM)
# pragma message("GLM: ARM instruction set")
# elif(GLM_ARCH & GLM_ARCH_AVX2)
# pragma message("GLM: AVX2 instruction set")
# elif(GLM_ARCH & GLM_ARCH_AVX)
# pragma message("GLM: AVX instruction set")
# elif(GLM_ARCH & GLM_ARCH_SSE3)
# pragma message("GLM: SSE3 instruction set")
# elif(GLM_ARCH & GLM_ARCH_SSE2)
# pragma message("GLM: SSE2 instruction set")
# endif//GLM_ARCH
#endif//GLM_MESSAGE
///////////////////////////////////////////////////////////////////////////////////
// C++ Version
@ -561,9 +676,9 @@
#elif GLM_LANG & GLM_LANG_CXX11_FLAG
# define GLM_HAS_STATIC_ASSERT 1
#else
# define GLM_HAS_STATIC_ASSERT (GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\
# define GLM_HAS_STATIC_ASSERT ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\
((GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC43)) || \
((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2010)))
((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2010))))
#endif
// N1988
@ -585,9 +700,9 @@
# define GLM_HAS_CONSTEXPR 1
# define GLM_HAS_CONSTEXPR_PARTIAL GLM_HAS_CONSTEXPR
#else
# define GLM_HAS_CONSTEXPR (GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\
((GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC46)))
# define GLM_HAS_CONSTEXPR_PARTIAL GLM_HAS_CONSTEXPR || ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2015))
# define GLM_HAS_CONSTEXPR ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\
((GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC46))))
# define GLM_HAS_CONSTEXPR_PARTIAL (GLM_HAS_CONSTEXPR || ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2015)))
#endif
// N2672
@ -596,9 +711,9 @@
#elif GLM_LANG & GLM_LANG_CXX11_FLAG
# define GLM_HAS_INITIALIZER_LISTS 1
#else
# define GLM_HAS_INITIALIZER_LISTS (GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\
# define GLM_HAS_INITIALIZER_LISTS ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\
((GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC44)) || \
((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2013)))
((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2013))))
#endif
// N2544 Unrestricted unions
@ -617,10 +732,10 @@
#elif GLM_LANG & GLM_LANG_CXX11_FLAG
# define GLM_HAS_DEFAULTED_FUNCTIONS 1
#else
# define GLM_HAS_DEFAULTED_FUNCTIONS (GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\
# define GLM_HAS_DEFAULTED_FUNCTIONS ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\
((GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC44)) || \
((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2013)) || \
((GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_COMPILER >= GLM_COMPILER_INTEL12)))
((GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_COMPILER >= GLM_COMPILER_INTEL12))))
#endif
// N2118
@ -629,9 +744,9 @@
#elif GLM_LANG & GLM_LANG_CXX11_FLAG
# define GLM_HAS_RVALUE_REFERENCES 1
#else
# define GLM_HAS_RVALUE_REFERENCES (GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\
# define GLM_HAS_RVALUE_REFERENCES ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\
((GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC43)) || \
((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2012)))
((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2012))))
#endif
// N2437 http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2437.pdf
@ -640,10 +755,10 @@
#elif GLM_LANG & GLM_LANG_CXX11_FLAG
# define GLM_HAS_EXPLICIT_CONVERSION_OPERATORS 1
#else
# define GLM_HAS_EXPLICIT_CONVERSION_OPERATORS (GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\
# define GLM_HAS_EXPLICIT_CONVERSION_OPERATORS ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\
((GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC45)) || \
((GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_COMPILER >= GLM_COMPILER_INTEL14)) || \
((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2013)))
((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2013))))
#endif
// N2258 http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2258.pdf
@ -652,10 +767,10 @@
#elif GLM_LANG & GLM_LANG_CXX11_FLAG
# define GLM_HAS_TEMPLATE_ALIASES 1
#else
# define GLM_HAS_TEMPLATE_ALIASES (GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\
# define GLM_HAS_TEMPLATE_ALIASES ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\
((GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_COMPILER >= GLM_COMPILER_INTEL12_1)) || \
((GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC47)) || \
((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2013)))
((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2013))))
#endif
// N2930 http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2009/n2930.html
@ -664,18 +779,18 @@
#elif GLM_LANG & GLM_LANG_CXX11_FLAG
# define GLM_HAS_RANGE_FOR 1
#else
# define GLM_HAS_RANGE_FOR (GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\
# define GLM_HAS_RANGE_FOR ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\
((GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC46)) || \
((GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_COMPILER >= GLM_COMPILER_INTEL13)) || \
((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2012)))
((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2012))))
#endif
//
#if GLM_LANG & GLM_LANG_CXX11_FLAG
# define GLM_HAS_ASSIGNABLE 1
#else
# define GLM_HAS_ASSIGNABLE (GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\
((GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC49)))
# define GLM_HAS_ASSIGNABLE ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\
((GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC49))))
#endif
//
@ -685,16 +800,15 @@
#if GLM_LANG & GLM_LANG_CXX11_FLAG
# define GLM_HAS_MAKE_SIGNED 1
#else
# define GLM_HAS_MAKE_SIGNED (GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\
((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2013)))
# define GLM_HAS_MAKE_SIGNED ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\
((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2013))))
#endif
//
#if GLM_ARCH == GLM_ARCH_PURE
# define GLM_HAS_BITSCAN_WINDOWS 0
#else
# define GLM_HAS_BITSCAN_WINDOWS (GLM_PLATFORM & GLM_PLATFORM_WINDOWS) && (\
(GLM_COMPILER & (GLM_COMPILER_VC | GLM_COMPILER_LLVM | GLM_COMPILER_INTEL))
# define GLM_HAS_BITSCAN_WINDOWS ((GLM_PLATFORM & GLM_PLATFORM_WINDOWS) && (\
(GLM_COMPILER & (GLM_COMPILER_VC | GLM_COMPILER_LLVM | GLM_COMPILER_INTEL))))
#endif
// OpenMP
@ -719,121 +833,6 @@
// Not standard
#define GLM_HAS_ANONYMOUS_UNION (GLM_LANG & GLM_LANG_CXXMS_FLAG)
///////////////////////////////////////////////////////////////////////////////////
// Platform
// User defines: GLM_FORCE_PURE GLM_FORCE_SSE2 GLM_FORCE_SSE3 GLM_FORCE_AVX GLM_FORCE_AVX2
#define GLM_ARCH_PURE 0x0000
#define GLM_ARCH_ARM 0x0001
#define GLM_ARCH_X86 0x0002
#define GLM_ARCH_SSE2 0x0004
#define GLM_ARCH_SSE3 0x0008
#define GLM_ARCH_SSE4 0x0010
#define GLM_ARCH_AVX 0x0020
#define GLM_ARCH_AVX2 0x0040
#if defined(GLM_FORCE_PURE)
# define GLM_ARCH GLM_ARCH_PURE
#elif defined(GLM_FORCE_AVX2)
# define GLM_ARCH (GLM_ARCH_AVX2 | GLM_ARCH_AVX | GLM_ARCH_SSE4 | GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
#elif defined(GLM_FORCE_AVX)
# define GLM_ARCH (GLM_ARCH_AVX | GLM_ARCH_SSE4 | GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
#elif defined(GLM_FORCE_SSE4)
# define GLM_ARCH (GLM_ARCH_SSE4 | GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
#elif defined(GLM_FORCE_SSE3)
# define GLM_ARCH (GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
#elif defined(GLM_FORCE_SSE2)
# define GLM_ARCH (GLM_ARCH_SSE2)
#elif (GLM_COMPILER & (GLM_COMPILER_APPLE_CLANG | GLM_COMPILER_LLVM | GLM_COMPILER_GCC)) || ((GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_PLATFORM & GLM_PLATFORM_LINUX))
# if(__AVX2__)
# define GLM_ARCH (GLM_ARCH_AVX2 | GLM_ARCH_AVX | GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
# elif(__AVX__)
# define GLM_ARCH (GLM_ARCH_AVX | GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
# elif(__SSE3__)
# define GLM_ARCH (GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
# elif(__SSE2__)
# define GLM_ARCH (GLM_ARCH_SSE2)
# else
# define GLM_ARCH GLM_ARCH_PURE
# endif
#elif (GLM_COMPILER & GLM_COMPILER_VC) || ((GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_PLATFORM & GLM_PLATFORM_WINDOWS))
# if defined(_M_ARM_FP)
# define GLM_ARCH (GLM_ARCH_ARM)
# elif defined(__AVX2__)
# define GLM_ARCH (GLM_ARCH_AVX2 | GLM_ARCH_AVX | GLM_ARCH_SSE4 | GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
# elif defined(__AVX__)
# define GLM_ARCH (GLM_ARCH_AVX | GLM_ARCH_SSE4 | GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
# elif _M_IX86_FP == 2
# define GLM_ARCH (GLM_ARCH_SSE2)
# else
# define GLM_ARCH (GLM_ARCH_PURE)
# endif
#elif (GLM_COMPILER & GLM_COMPILER_GCC) && (defined(__i386__) || defined(__x86_64__))
# if defined(__AVX2__)
# define GLM_ARCH (GLM_ARCH_AVX2 | GLM_ARCH_AVX | GLM_ARCH_SSE4 | GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
# elif defined(__AVX__)
# define GLM_ARCH (GLM_ARCH_AVX | GLM_ARCH_SSE4 | GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
# elif defined(__SSE4_1__ )
# define GLM_ARCH (GLM_ARCH_SSE4 | GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
# elif defined(__SSE3__)
# define GLM_ARCH (GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
# elif defined(__SSE2__)
# define GLM_ARCH (GLM_ARCH_SSE2)
# else
# define GLM_ARCH (GLM_ARCH_PURE)
# endif
#else
# define GLM_ARCH GLM_ARCH_PURE
#endif
// With MinGW-W64, including intrinsic headers before intrin.h will produce some errors. The problem is
// that windows.h (and maybe other headers) will silently include intrin.h, which of course causes problems.
// To fix, we just explicitly include intrin.h here.
#if defined(__MINGW64__) && (GLM_ARCH != GLM_ARCH_PURE)
# include <intrin.h>
#endif
#if GLM_ARCH & GLM_ARCH_AVX2
# include <immintrin.h>
#endif//GLM_ARCH
#if GLM_ARCH & GLM_ARCH_AVX
# include <immintrin.h>
#endif//GLM_ARCH
#if GLM_ARCH & GLM_ARCH_SSE4
# include <smmintrin.h>
#endif//GLM_ARCH
#if GLM_ARCH & GLM_ARCH_SSE3
# include <pmmintrin.h>
#endif//GLM_ARCH
#if GLM_ARCH & GLM_ARCH_SSE2
# include <emmintrin.h>
# if(GLM_COMPILER == GLM_COMPILER_VC2005) // VC2005 is missing some intrinsics, workaround
inline float _mm_cvtss_f32(__m128 A) { return A.m128_f32[0]; }
inline __m128 _mm_castpd_ps(__m128d PD) { union { __m128 ps; __m128d pd; } c; c.pd = PD; return c.ps; }
inline __m128d _mm_castps_pd(__m128 PS) { union { __m128 ps; __m128d pd; } c; c.ps = PS; return c.pd; }
inline __m128i _mm_castps_si128(__m128 PS) { union { __m128 ps; __m128i pi; } c; c.ps = PS; return c.pi; }
inline __m128 _mm_castsi128_ps(__m128i PI) { union { __m128 ps; __m128i pi; } c; c.pi = PI; return c.ps; }
# endif
#endif//GLM_ARCH
#if defined(GLM_MESSAGES) && !defined(GLM_MESSAGE_ARCH_DISPLAYED)
# define GLM_MESSAGE_ARCH_DISPLAYED
# if(GLM_ARCH == GLM_ARCH_PURE)
# pragma message("GLM: Platform independent code")
# elif(GLM_ARCH & GLM_ARCH_ARM)
# pragma message("GLM: ARM instruction set")
# elif(GLM_ARCH & GLM_ARCH_AVX2)
# pragma message("GLM: AVX2 instruction set")
# elif(GLM_ARCH & GLM_ARCH_AVX)
# pragma message("GLM: AVX instruction set")
# elif(GLM_ARCH & GLM_ARCH_SSE3)
# pragma message("GLM: SSE3 instruction set")
# elif(GLM_ARCH & GLM_ARCH_SSE2)
# pragma message("GLM: SSE2 instruction set")
# endif//GLM_ARCH
#endif//GLM_MESSAGE
///////////////////////////////////////////////////////////////////////////////////
// Static assert

View File

@ -61,6 +61,10 @@ namespace glm
static GLM_RELAXED_CONSTEXPR precision prec = P;
# endif//GLM_META_PROG_HELPERS
# ifdef GLM_STATIC_CONST_MEMBERS
static const type ZERO;
static const type IDENTITY;
# endif
private:
col_type value[2];
@ -222,6 +226,16 @@ namespace glm
template <typename T, precision P>
GLM_FUNC_DECL bool operator!=(tmat2x2<T, P> const & m1, tmat2x2<T, P> const & m2);
// -- Is type --
template <typename T, precision P>
struct type<T, P, tmat2x2>
{
static bool const is_vec = false;
static bool const is_mat = true;
static bool const is_quat = false;
};
} //namespace glm
#ifndef GLM_EXTERNAL_TEMPLATE

View File

@ -50,6 +50,13 @@ namespace detail
}
}//namespace detail
# ifdef GLM_STATIC_CONST_MEMBERS
template<typename T, precision P>
const tmat2x2<T, P> tmat2x2<T, P>::ZERO(static_cast<T>(0));
template<typename T, precision P>
const tmat2x2<T, P> tmat2x2<T, P>::IDENTITY(static_cast<T>(1));
# endif
// -- Constructors --
# if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT)

View File

@ -57,6 +57,11 @@ namespace glm
static GLM_RELAXED_CONSTEXPR precision prec = P;
# endif//GLM_META_PROG_HELPERS
# ifdef GLM_STATIC_CONST_MEMBERS
static const type ZERO;
static const type IDENTITY;
# endif
private:
col_type value[2];
@ -199,6 +204,16 @@ namespace glm
template <typename T, precision P>
GLM_FUNC_DECL bool operator!=(tmat2x3<T, P> const & m1, tmat2x3<T, P> const & m2);
// -- Is type --
template <typename T, precision P>
struct type<T, P, tmat2x3>
{
static bool const is_vec = false;
static bool const is_mat = true;
static bool const is_quat = false;
};
}//namespace glm
#ifndef GLM_EXTERNAL_TEMPLATE

View File

@ -32,6 +32,13 @@
namespace glm
{
# ifdef GLM_STATIC_CONST_MEMBERS
template<typename T, precision P>
const tmat2x3<T, P> tmat2x3<T, P>::ZERO(static_cast<T>(0));
template<typename T, precision P>
const tmat2x3<T, P> tmat2x3<T, P>::IDENTITY(static_cast<T>(1));
# endif
// -- Constructors --
# if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT)

View File

@ -57,6 +57,11 @@ namespace glm
static GLM_RELAXED_CONSTEXPR precision prec = P;
# endif//GLM_META_PROG_HELPERS
# ifdef GLM_STATIC_CONST_MEMBERS
static const type ZERO;
static const type IDENTITY;
# endif
private:
col_type value[2];
@ -201,6 +206,16 @@ namespace glm
template <typename T, precision P>
GLM_FUNC_DECL bool operator!=(tmat2x4<T, P> const & m1, tmat2x4<T, P> const & m2);
// -- Is type --
template <typename T, precision P>
struct type<T, P, tmat2x4>
{
static bool const is_vec = false;
static bool const is_mat = true;
static bool const is_quat = false;
};
}//namespace glm
#ifndef GLM_EXTERNAL_TEMPLATE

View File

@ -32,6 +32,13 @@
namespace glm
{
# ifdef GLM_STATIC_CONST_MEMBERS
template<typename T, precision P>
const tmat2x4<T, P> tmat2x4<T, P>::ZERO(static_cast<T>(0));
template<typename T, precision P>
const tmat2x4<T, P> tmat2x4<T, P>::IDENTITY(static_cast<T>(1));
# endif
// -- Constructors --
# if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT)

View File

@ -57,6 +57,11 @@ namespace glm
static GLM_RELAXED_CONSTEXPR precision prec = P;
# endif//GLM_META_PROG_HELPERS
# ifdef GLM_STATIC_CONST_MEMBERS
static const type ZERO;
static const type IDENTITY;
# endif
private:
col_type value[3];
@ -206,6 +211,16 @@ namespace glm
template <typename T, precision P>
GLM_FUNC_DECL bool operator!=(tmat3x2<T, P> const & m1, tmat3x2<T, P> const & m2);
// -- Is type --
template <typename T, precision P>
struct type<T, P, tmat3x2>
{
static bool const is_vec = false;
static bool const is_mat = true;
static bool const is_quat = false;
};
}//namespace glm
#ifndef GLM_EXTERNAL_TEMPLATE

View File

@ -32,6 +32,13 @@
namespace glm
{
# ifdef GLM_STATIC_CONST_MEMBERS
template<typename T, precision P>
const tmat3x2<T, P> tmat3x2<T, P>::ZERO(static_cast<T>(0));
template<typename T, precision P>
const tmat3x2<T, P> tmat3x2<T, P>::IDENTITY(static_cast<T>(1));
# endif
// -- Constructors --
# if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT)

View File

@ -56,6 +56,11 @@ namespace glm
static GLM_RELAXED_CONSTEXPR precision prec = P;
# endif//GLM_META_PROG_HELPERS
# ifdef GLM_STATIC_CONST_MEMBERS
static const type ZERO;
static const type IDENTITY;
# endif
template <typename U, precision Q>
friend tvec3<U, Q> operator/(tmat3x3<U, Q> const & m, tvec3<U, Q> const & v);
template <typename U, precision Q>
@ -229,6 +234,16 @@ namespace glm
template <typename T, precision P>
GLM_FUNC_DECL bool operator!=(tmat3x3<T, P> const & m1, tmat3x3<T, P> const & m2);
// -- Is type --
template <typename T, precision P>
struct type<T, P, tmat3x3>
{
static bool const is_vec = false;
static bool const is_mat = true;
static bool const is_quat = false;
};
}//namespace glm
#ifndef GLM_EXTERNAL_TEMPLATE

View File

@ -56,6 +56,14 @@ namespace detail
}
}//namespace detail
# ifdef GLM_STATIC_CONST_MEMBERS
template<typename T, precision P>
const tmat3x3<T, P> tmat3x3<T, P>::ZERO(static_cast<T>(0));
template<typename T, precision P>
const tmat3x3<T, P> tmat3x3<T, P>::IDENTITY(static_cast<T>(1));
# endif
// -- Constructors --
# if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT)

View File

@ -57,6 +57,11 @@ namespace glm
static GLM_RELAXED_CONSTEXPR precision prec = P;
# endif//GLM_META_PROG_HELPERS
# ifdef GLM_STATIC_CONST_MEMBERS
static const type ZERO;
static const type IDENTITY;
# endif
private:
col_type value[3];
@ -206,6 +211,16 @@ namespace glm
template <typename T, precision P>
GLM_FUNC_DECL bool operator!=(tmat3x4<T, P> const & m1, tmat3x4<T, P> const & m2);
// -- Is type --
template <typename T, precision P>
struct type<T, P, tmat3x4>
{
static bool const is_vec = false;
static bool const is_mat = true;
static bool const is_quat = false;
};
}//namespace glm
#ifndef GLM_EXTERNAL_TEMPLATE

View File

@ -32,6 +32,13 @@
namespace glm
{
# ifdef GLM_STATIC_CONST_MEMBERS
template<typename T, precision P>
const tmat3x4<T, P> tmat3x4<T, P>::ZERO(static_cast<T>(0));
template<typename T, precision P>
const tmat3x4<T, P> tmat3x4<T, P>::IDENTITY(static_cast<T>(1));
# endif
// -- Constructors --
# if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT)

View File

@ -57,6 +57,11 @@ namespace glm
static GLM_RELAXED_CONSTEXPR precision prec = P;
# endif//GLM_META_PROG_HELPERS
# ifdef GLM_STATIC_CONST_MEMBERS
static const type ZERO;
static const type IDENTITY;
# endif
private:
col_type value[4];
@ -211,6 +216,16 @@ namespace glm
template <typename T, precision P>
GLM_FUNC_DECL bool operator!=(tmat4x2<T, P> const & m1, tmat4x2<T, P> const & m2);
// -- Is type --
template <typename T, precision P>
struct type<T, P, tmat4x2>
{
static bool const is_vec = false;
static bool const is_mat = true;
static bool const is_quat = false;
};
}//namespace glm
#ifndef GLM_EXTERNAL_TEMPLATE

View File

@ -32,6 +32,13 @@
namespace glm
{
# ifdef GLM_STATIC_CONST_MEMBERS
template<typename T, precision P>
const tmat4x2<T, P> tmat4x2<T, P>::ZERO(static_cast<T>(0));
template<typename T, precision P>
const tmat4x2<T, P> tmat4x2<T, P>::IDENTITY(static_cast<T>(1));
# endif
// -- Constructors --
# if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT)

View File

@ -57,6 +57,11 @@ namespace glm
static GLM_RELAXED_CONSTEXPR precision prec = P;
# endif//GLM_META_PROG_HELPERS
# ifdef GLM_STATIC_CONST_MEMBERS
static const type ZERO;
static const type IDENTITY;
# endif
private:
col_type value[4];
@ -211,6 +216,16 @@ namespace glm
template <typename T, precision P>
GLM_FUNC_DECL bool operator!=(tmat4x3<T, P> const & m1, tmat4x3<T, P> const & m2);
// -- Is type --
template <typename T, precision P>
struct type<T, P, tmat4x3>
{
static bool const is_vec = false;
static bool const is_mat = true;
static bool const is_quat = false;
};
}//namespace glm
#ifndef GLM_EXTERNAL_TEMPLATE

View File

@ -32,6 +32,13 @@
namespace glm
{
# ifdef GLM_STATIC_CONST_MEMBERS
template<typename T, precision P>
const tmat4x3<T, P> tmat4x3<T, P>::ZERO(static_cast<T>(0));
template<typename T, precision P>
const tmat4x3<T, P> tmat4x3<T, P>::IDENTITY(static_cast<T>(1));
# endif
// -- Constructors --
# if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT)

View File

@ -56,6 +56,11 @@ namespace glm
static GLM_RELAXED_CONSTEXPR precision prec = P;
# endif//GLM_META_PROG_HELPERS
# ifdef GLM_STATIC_CONST_MEMBERS
static const type ZERO;
static const type IDENTITY;
# endif
template <typename U, precision Q>
friend tvec4<U, Q> operator/(tmat4x4<U, Q> const & m, tvec4<U, Q> const & v);
template <typename U, precision Q>
@ -234,6 +239,16 @@ namespace glm
template <typename T, precision P>
GLM_FUNC_DECL bool operator!=(tmat4x4<T, P> const & m1, tmat4x4<T, P> const & m2);
// -- Is type --
template <typename T, precision P>
struct type<T, P, tmat4x4>
{
static bool const is_vec = false;
static bool const is_mat = true;
static bool const is_quat = false;
};
}//namespace glm
#ifndef GLM_EXTERNAL_TEMPLATE

View File

@ -92,6 +92,13 @@ namespace detail
}
}//namespace detail
# ifdef GLM_STATIC_CONST_MEMBERS
template<typename T, precision P>
const tmat4x4<T, P> tmat4x4<T, P>::ZERO(static_cast<T>(0));
template<typename T, precision P>
const tmat4x4<T, P> tmat4x4<T, P>::IDENTITY(static_cast<T>(1));
# endif
// -- Constructors --
# if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT)

View File

@ -59,6 +59,10 @@ namespace glm
static GLM_RELAXED_CONSTEXPR precision prec = P;
# endif//GLM_META_PROG_HELPERS
# ifdef GLM_STATIC_CONST_MEMBERS
static const type ZERO;
static const type X;
# endif
// -- Data --
# if GLM_HAS_ANONYMOUS_UNION
@ -116,7 +120,7 @@ namespace glm
// -- Explicit basic constructors --
GLM_FUNC_DECL explicit tvec1(ctor);
GLM_FUNC_DECL explicit tvec1(T const & s);
GLM_FUNC_DECL explicit tvec1(T const & scalar);
// -- Conversion vector constructors --
@ -151,19 +155,19 @@ namespace glm
template <typename U>
GLM_FUNC_DECL tvec1<T, P> & operator=(tvec1<U, P> const & v);
template <typename U>
GLM_FUNC_DECL tvec1<T, P> & operator+=(U const & s);
GLM_FUNC_DECL tvec1<T, P> & operator+=(U const & scalar);
template <typename U>
GLM_FUNC_DECL tvec1<T, P> & operator+=(tvec1<U, P> const & v);
template <typename U>
GLM_FUNC_DECL tvec1<T, P> & operator-=(U const & s);
GLM_FUNC_DECL tvec1<T, P> & operator-=(U const & scalar);
template <typename U>
GLM_FUNC_DECL tvec1<T, P> & operator-=(tvec1<U, P> const & v);
template <typename U>
GLM_FUNC_DECL tvec1<T, P> & operator*=(U const & s);
GLM_FUNC_DECL tvec1<T, P> & operator*=(U const & scalar);
template <typename U>
GLM_FUNC_DECL tvec1<T, P> & operator*=(tvec1<U, P> const & v);
template <typename U>
GLM_FUNC_DECL tvec1<T, P> & operator/=(U const & s);
GLM_FUNC_DECL tvec1<T, P> & operator/=(U const & scalar);
template <typename U>
GLM_FUNC_DECL tvec1<T, P> & operator/=(tvec1<U, P> const & v);
@ -177,27 +181,27 @@ namespace glm
// -- Unary bit operators --
template <typename U>
GLM_FUNC_DECL tvec1<T, P> & operator%=(U const & s);
GLM_FUNC_DECL tvec1<T, P> & operator%=(U const & scalar);
template <typename U>
GLM_FUNC_DECL tvec1<T, P> & operator%=(tvec1<U, P> const & v);
template <typename U>
GLM_FUNC_DECL tvec1<T, P> & operator&=(U const & s);
GLM_FUNC_DECL tvec1<T, P> & operator&=(U const & scalar);
template <typename U>
GLM_FUNC_DECL tvec1<T, P> & operator&=(tvec1<U, P> const & v);
template <typename U>
GLM_FUNC_DECL tvec1<T, P> & operator|=(U const & s);
GLM_FUNC_DECL tvec1<T, P> & operator|=(U const & scalar);
template <typename U>
GLM_FUNC_DECL tvec1<T, P> & operator|=(tvec1<U, P> const & v);
template <typename U>
GLM_FUNC_DECL tvec1<T, P> & operator^=(U const & s);
GLM_FUNC_DECL tvec1<T, P> & operator^=(U const & scalar);
template <typename U>
GLM_FUNC_DECL tvec1<T, P> & operator^=(tvec1<U, P> const & v);
template <typename U>
GLM_FUNC_DECL tvec1<T, P> & operator<<=(U const & s);
GLM_FUNC_DECL tvec1<T, P> & operator<<=(U const & scalar);
template <typename U>
GLM_FUNC_DECL tvec1<T, P> & operator<<=(tvec1<U, P> const & v);
template <typename U>
GLM_FUNC_DECL tvec1<T, P> & operator>>=(U const & s);
GLM_FUNC_DECL tvec1<T, P> & operator>>=(U const & scalar);
template <typename U>
GLM_FUNC_DECL tvec1<T, P> & operator>>=(tvec1<U, P> const & v);
};
@ -210,91 +214,91 @@ namespace glm
// -- Binary operators --
template <typename T, precision P>
GLM_FUNC_DECL tvec1<T, P> operator+(tvec1<T, P> const & v, T const & s);
GLM_FUNC_DECL tvec1<T, P> operator+(tvec1<T, P> const & v, T const & scalar);
template <typename T, precision P>
GLM_FUNC_DECL tvec1<T, P> operator+(T const & s, tvec1<T, P> const & v);
GLM_FUNC_DECL tvec1<T, P> operator+(T const & scalar, tvec1<T, P> const & v);
template <typename T, precision P>
GLM_FUNC_DECL tvec1<T, P> operator+(tvec1<T, P> const & v1, tvec1<T, P> const & v2);
template <typename T, precision P>
GLM_FUNC_DECL tvec1<T, P> operator-(tvec1<T, P> const & v, T const & s);
GLM_FUNC_DECL tvec1<T, P> operator-(tvec1<T, P> const & v, T const & scalar);
template <typename T, precision P>
GLM_FUNC_DECL tvec1<T, P> operator-(T const & s, tvec1<T, P> const & v);
GLM_FUNC_DECL tvec1<T, P> operator-(T const & scalar, tvec1<T, P> const & v);
template <typename T, precision P>
GLM_FUNC_DECL tvec1<T, P> operator- (tvec1<T, P> const & v1, tvec1<T, P> const & v2);
template <typename T, precision P>
GLM_FUNC_DECL tvec1<T, P> operator*(tvec1<T, P> const & v, T const & s);
GLM_FUNC_DECL tvec1<T, P> operator*(tvec1<T, P> const & v, T const & scalar);
template <typename T, precision P>
GLM_FUNC_DECL tvec1<T, P> operator*(T const & s, tvec1<T, P> const & v);
GLM_FUNC_DECL tvec1<T, P> operator*(T const & scalar, tvec1<T, P> const & v);
template <typename T, precision P>
GLM_FUNC_DECL tvec1<T, P> operator*(tvec1<T, P> const & v1, tvec1<T, P> const & v2);
template <typename T, precision P>
GLM_FUNC_DECL tvec1<T, P> operator/(tvec1<T, P> const & v, T const & s);
GLM_FUNC_DECL tvec1<T, P> operator/(tvec1<T, P> const & v, T const & scalar);
template <typename T, precision P>
GLM_FUNC_DECL tvec1<T, P> operator/(T const & s, tvec1<T, P> const & v);
GLM_FUNC_DECL tvec1<T, P> operator/(T const & scalar, tvec1<T, P> const & v);
template <typename T, precision P>
GLM_FUNC_DECL tvec1<T, P> operator/(tvec1<T, P> const & v1, tvec1<T, P> const & v2);
template <typename T, precision P>
GLM_FUNC_DECL tvec1<T, P> operator%(tvec1<T, P> const & v, T const & s);
GLM_FUNC_DECL tvec1<T, P> operator%(tvec1<T, P> const & v, T const & scalar);
template <typename T, precision P>
GLM_FUNC_DECL tvec1<T, P> operator%(T const & s, tvec1<T, P> const & v);
GLM_FUNC_DECL tvec1<T, P> operator%(T const & scalar, tvec1<T, P> const & v);
template <typename T, precision P>
GLM_FUNC_DECL tvec1<T, P> operator%(tvec1<T, P> const & v1, tvec1<T, P> const & v2);
template <typename T, precision P>
GLM_FUNC_DECL tvec1<T, P> operator&(tvec1<T, P> const & v, T const & s);
GLM_FUNC_DECL tvec1<T, P> operator&(tvec1<T, P> const & v, T const & scalar);
template <typename T, precision P>
GLM_FUNC_DECL tvec1<T, P> operator&(T const & s, tvec1<T, P> const & v);
GLM_FUNC_DECL tvec1<T, P> operator&(T const & scalar, tvec1<T, P> const & v);
template <typename T, precision P>
GLM_FUNC_DECL tvec1<T, P> operator&(tvec1<T, P> const & v1, tvec1<T, P> const & v2);
template <typename T, precision P>
GLM_FUNC_DECL tvec1<T, P> operator|(tvec1<T, P> const & v, T const & s);
GLM_FUNC_DECL tvec1<T, P> operator|(tvec1<T, P> const & v, T const & scalar);
template <typename T, precision P>
GLM_FUNC_DECL tvec1<T, P> operator|(T const & s, tvec1<T, P> const & v);
GLM_FUNC_DECL tvec1<T, P> operator|(T const & scalar, tvec1<T, P> const & v);
template <typename T, precision P>
GLM_FUNC_DECL tvec1<T, P> operator|(tvec1<T, P> const & v1, tvec1<T, P> const & v2);
template <typename T, precision P>
GLM_FUNC_DECL tvec1<T, P> operator^(tvec1<T, P> const & v, T const & s);
GLM_FUNC_DECL tvec1<T, P> operator^(tvec1<T, P> const & v, T const & scalar);
template <typename T, precision P>
GLM_FUNC_DECL tvec1<T, P> operator^(T const & s, tvec1<T, P> const & v);
GLM_FUNC_DECL tvec1<T, P> operator^(T const & scalar, tvec1<T, P> const & v);
template <typename T, precision P>
GLM_FUNC_DECL tvec1<T, P> operator^(tvec1<T, P> const & v1, tvec1<T, P> const & v2);
template <typename T, precision P>
GLM_FUNC_DECL tvec1<T, P> operator<<(tvec1<T, P> const & v, T const & s);
GLM_FUNC_DECL tvec1<T, P> operator<<(tvec1<T, P> const & v, T const & scalar);
template <typename T, precision P>
GLM_FUNC_DECL tvec1<T, P> operator<<(T const & s, tvec1<T, P> const & v);
GLM_FUNC_DECL tvec1<T, P> operator<<(T const & scalar, tvec1<T, P> const & v);
template <typename T, precision P>
GLM_FUNC_DECL tvec1<T, P> operator<<(tvec1<T, P> const & v1, tvec1<T, P> const & v2);
template <typename T, precision P>
GLM_FUNC_DECL tvec1<T, P> operator>>(tvec1<T, P> const & v, T const & s);
GLM_FUNC_DECL tvec1<T, P> operator>>(tvec1<T, P> const & v, T const & scalar);
template <typename T, precision P>
GLM_FUNC_DECL tvec1<T, P> operator>>(T const & s, tvec1<T, P> const & v);
GLM_FUNC_DECL tvec1<T, P> operator>>(T const & scalar, tvec1<T, P> const & v);
template <typename T, precision P>
GLM_FUNC_DECL tvec1<T, P> operator>>(tvec1<T, P> const & v1, tvec1<T, P> const & v2);
@ -309,6 +313,16 @@ namespace glm
template <typename T, precision P>
GLM_FUNC_DECL bool operator!=(tvec1<T, P> const & v1, tvec1<T, P> const & v2);
// -- Is type --
template <typename T, precision P>
struct type<T, P, tvec1>
{
static bool const is_vec = true;
static bool const is_mat = false;
static bool const is_quat = false;
};
}//namespace glm
#ifndef GLM_EXTERNAL_TEMPLATE

View File

@ -32,6 +32,13 @@
namespace glm
{
# ifdef GLM_STATIC_CONST_MEMBERS
template<typename T, precision P>
const tvec1<T, P> tvec1<T, P>::X(static_cast<T>(1));
template<typename T, precision P>
const tvec1<T, P> tvec1<T, P>::ZERO(static_cast<T>(0));
# endif
// -- Implicit basic constructors --
# if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT)
@ -63,8 +70,8 @@ namespace glm
{}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec1<T, P>::tvec1(T const & s)
: x(s)
GLM_FUNC_QUALIFIER tvec1<T, P>::tvec1(T const & scalar)
: x(scalar)
{}
// -- Conversion vector constructors --
@ -158,9 +165,9 @@ namespace glm
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec1<T, P> & tvec1<T, P>::operator+=(U const & s)
GLM_FUNC_QUALIFIER tvec1<T, P> & tvec1<T, P>::operator+=(U const & scalar)
{
this->x += static_cast<T>(s);
this->x += static_cast<T>(scalar);
return *this;
}
@ -174,9 +181,9 @@ namespace glm
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec1<T, P> & tvec1<T, P>::operator-=(U const & s)
GLM_FUNC_QUALIFIER tvec1<T, P> & tvec1<T, P>::operator-=(U const & scalar)
{
this->x -= static_cast<T>(s);
this->x -= static_cast<T>(scalar);
return *this;
}
@ -190,9 +197,9 @@ namespace glm
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec1<T, P> & tvec1<T, P>::operator*=(U const & s)
GLM_FUNC_QUALIFIER tvec1<T, P> & tvec1<T, P>::operator*=(U const & scalar)
{
this->x *= static_cast<T>(s);
this->x *= static_cast<T>(scalar);
return *this;
}
@ -206,9 +213,9 @@ namespace glm
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec1<T, P> & tvec1<T, P>::operator/=(U const & s)
GLM_FUNC_QUALIFIER tvec1<T, P> & tvec1<T, P>::operator/=(U const & scalar)
{
this->x /= static_cast<T>(s);
this->x /= static_cast<T>(scalar);
return *this;
}
@ -256,9 +263,9 @@ namespace glm
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec1<T, P> & tvec1<T, P>::operator%=(U const & s)
GLM_FUNC_QUALIFIER tvec1<T, P> & tvec1<T, P>::operator%=(U const & scalar)
{
this->x %= static_cast<T>(s);
this->x %= static_cast<T>(scalar);
return *this;
}
@ -272,9 +279,9 @@ namespace glm
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec1<T, P> & tvec1<T, P>::operator&=(U const & s)
GLM_FUNC_QUALIFIER tvec1<T, P> & tvec1<T, P>::operator&=(U const & scalar)
{
this->x &= static_cast<T>(s);
this->x &= static_cast<T>(scalar);
return *this;
}
@ -288,9 +295,9 @@ namespace glm
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec1<T, P> & tvec1<T, P>::operator|=(U const & s)
GLM_FUNC_QUALIFIER tvec1<T, P> & tvec1<T, P>::operator|=(U const & scalar)
{
this->x |= static_cast<T>(s);
this->x |= static_cast<T>(scalar);
return *this;
}
@ -304,9 +311,9 @@ namespace glm
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec1<T, P> & tvec1<T, P>::operator^=(U const & s)
GLM_FUNC_QUALIFIER tvec1<T, P> & tvec1<T, P>::operator^=(U const & scalar)
{
this->x ^= static_cast<T>(s);
this->x ^= static_cast<T>(scalar);
return *this;
}
@ -320,9 +327,9 @@ namespace glm
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec1<T, P> & tvec1<T, P>::operator<<=(U const & s)
GLM_FUNC_QUALIFIER tvec1<T, P> & tvec1<T, P>::operator<<=(U const & scalar)
{
this->x <<= static_cast<T>(s);
this->x <<= static_cast<T>(scalar);
return *this;
}
@ -336,9 +343,9 @@ namespace glm
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec1<T, P> & tvec1<T, P>::operator>>=(U const & s)
GLM_FUNC_QUALIFIER tvec1<T, P> & tvec1<T, P>::operator>>=(U const & scalar)
{
this->x >>= static_cast<T>(s);
this->x >>= static_cast<T>(scalar);
return *this;
}
@ -362,17 +369,17 @@ namespace glm
// -- Binary arithmetic operators --
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec1<T, P> operator+(tvec1<T, P> const & v, T const & s)
GLM_FUNC_QUALIFIER tvec1<T, P> operator+(tvec1<T, P> const & v, T const & scalar)
{
return tvec1<T, P>(
v.x + s);
v.x + scalar);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec1<T, P> operator+(T const & s, tvec1<T, P> const & v)
GLM_FUNC_QUALIFIER tvec1<T, P> operator+(T const & scalar, tvec1<T, P> const & v)
{
return tvec1<T, P>(
s + v.x);
scalar + v.x);
}
template <typename T, precision P>
@ -384,17 +391,17 @@ namespace glm
//operator-
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec1<T, P> operator-(tvec1<T, P> const & v, T const & s)
GLM_FUNC_QUALIFIER tvec1<T, P> operator-(tvec1<T, P> const & v, T const & scalar)
{
return tvec1<T, P>(
v.x - s);
v.x - scalar);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec1<T, P> operator-(T const & s, tvec1<T, P> const & v)
GLM_FUNC_QUALIFIER tvec1<T, P> operator-(T const & scalar, tvec1<T, P> const & v)
{
return tvec1<T, P>(
s - v.x);
scalar - v.x);
}
template <typename T, precision P>
@ -405,17 +412,17 @@ namespace glm
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec1<T, P> operator*(tvec1<T, P> const & v, T const & s)
GLM_FUNC_QUALIFIER tvec1<T, P> operator*(tvec1<T, P> const & v, T const & scalar)
{
return tvec1<T, P>(
v.x * s);
v.x * scalar);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec1<T, P> operator*(T const & s, tvec1<T, P> const & v)
GLM_FUNC_QUALIFIER tvec1<T, P> operator*(T const & scalar, tvec1<T, P> const & v)
{
return tvec1<T, P>(
s * v.x);
scalar * v.x);
}
template <typename T, precision P>
@ -426,17 +433,17 @@ namespace glm
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec1<T, P> operator/(tvec1<T, P> const & v, T const & s)
GLM_FUNC_QUALIFIER tvec1<T, P> operator/(tvec1<T, P> const & v, T const & scalar)
{
return tvec1<T, P>(
v.x / s);
v.x / scalar);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec1<T, P> operator/(T const & s, tvec1<T, P> const & v)
GLM_FUNC_QUALIFIER tvec1<T, P> operator/(T const & scalar, tvec1<T, P> const & v)
{
return tvec1<T, P>(
s / v.x);
scalar / v.x);
}
template <typename T, precision P>
@ -449,17 +456,17 @@ namespace glm
// -- Binary bit operators --
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec1<T, P> operator%(tvec1<T, P> const & v, T const & s)
GLM_FUNC_QUALIFIER tvec1<T, P> operator%(tvec1<T, P> const & v, T const & scalar)
{
return tvec1<T, P>(
v.x % s);
v.x % scalar);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec1<T, P> operator%(T const & s, tvec1<T, P> const & v)
GLM_FUNC_QUALIFIER tvec1<T, P> operator%(T const & scalar, tvec1<T, P> const & v)
{
return tvec1<T, P>(
s % v.x);
scalar % v.x);
}
template <typename T, precision P>
@ -470,17 +477,17 @@ namespace glm
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec1<T, P> operator&(tvec1<T, P> const & v, T const & s)
GLM_FUNC_QUALIFIER tvec1<T, P> operator&(tvec1<T, P> const & v, T const & scalar)
{
return tvec1<T, P>(
v.x & s);
v.x & scalar);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec1<T, P> operator&(T const & s, tvec1<T, P> const & v)
GLM_FUNC_QUALIFIER tvec1<T, P> operator&(T const & scalar, tvec1<T, P> const & v)
{
return tvec1<T, P>(
s & v.x);
scalar & v.x);
}
template <typename T, precision P>
@ -491,17 +498,17 @@ namespace glm
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec1<T, P> operator|(tvec1<T, P> const & v, T const & s)
GLM_FUNC_QUALIFIER tvec1<T, P> operator|(tvec1<T, P> const & v, T const & scalar)
{
return tvec1<T, P>(
v.x | s);
v.x | scalar);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec1<T, P> operator|(T const & s, tvec1<T, P> const & v)
GLM_FUNC_QUALIFIER tvec1<T, P> operator|(T const & scalar, tvec1<T, P> const & v)
{
return tvec1<T, P>(
s | v.x);
scalar | v.x);
}
template <typename T, precision P>
@ -512,17 +519,17 @@ namespace glm
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec1<T, P> operator^(tvec1<T, P> const & v, T const & s)
GLM_FUNC_QUALIFIER tvec1<T, P> operator^(tvec1<T, P> const & v, T const & scalar)
{
return tvec1<T, P>(
v.x ^ s);
v.x ^ scalar);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec1<T, P> operator^(T const & s, tvec1<T, P> const & v)
GLM_FUNC_QUALIFIER tvec1<T, P> operator^(T const & scalar, tvec1<T, P> const & v)
{
return tvec1<T, P>(
s ^ v.x);
scalar ^ v.x);
}
template <typename T, precision P>
@ -533,17 +540,17 @@ namespace glm
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec1<T, P> operator<<(tvec1<T, P> const & v, T const & s)
GLM_FUNC_QUALIFIER tvec1<T, P> operator<<(tvec1<T, P> const & v, T const & scalar)
{
return tvec1<T, P>(
v.x << s);
v.x << scalar);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec1<T, P> operator<<(T const & s, tvec1<T, P> const & v)
GLM_FUNC_QUALIFIER tvec1<T, P> operator<<(T const & scalar, tvec1<T, P> const & v)
{
return tvec1<T, P>(
s << v.x);
scalar << v.x);
}
template <typename T, precision P>
@ -554,17 +561,17 @@ namespace glm
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec1<T, P> operator>>(tvec1<T, P> const & v, T const & s)
GLM_FUNC_QUALIFIER tvec1<T, P> operator>>(tvec1<T, P> const & v, T const & scalar)
{
return tvec1<T, P>(
v.x >> s);
v.x >> scalar);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec1<T, P> operator>>(T const & s, tvec1<T, P> const & v)
GLM_FUNC_QUALIFIER tvec1<T, P> operator>>(T const & scalar, tvec1<T, P> const & v)
{
return tvec1<T, P>(
s >> v.x);
scalar >> v.x);
}
template <typename T, precision P>

View File

@ -58,6 +58,13 @@ namespace glm
static GLM_RELAXED_CONSTEXPR precision prec = P;
# endif//GLM_META_PROG_HELPERS
# ifdef GLM_STATIC_CONST_MEMBERS
static const type ZERO;
static const type X;
static const type Y;
static const type XY;
# endif
// -- Data --
# if GLM_HAS_ANONYMOUS_UNION
@ -116,7 +123,7 @@ namespace glm
// -- Explicit basic constructors --
GLM_FUNC_DECL explicit tvec2(ctor);
GLM_FUNC_DECL explicit tvec2(T const & s);
GLM_FUNC_DECL explicit tvec2(T const & scalar);
GLM_FUNC_DECL tvec2(T const & s1, T const & s2);
// -- Conversion constructors --
@ -157,25 +164,25 @@ namespace glm
template <typename U>
GLM_FUNC_DECL tvec2<T, P>& operator=(tvec2<U, P> const & v);
template <typename U>
GLM_FUNC_DECL tvec2<T, P>& operator+=(U s);
GLM_FUNC_DECL tvec2<T, P>& operator+=(U scalar);
template <typename U>
GLM_FUNC_DECL tvec2<T, P>& operator+=(tvec1<U, P> const & v);
template <typename U>
GLM_FUNC_DECL tvec2<T, P>& operator+=(tvec2<U, P> const & v);
template <typename U>
GLM_FUNC_DECL tvec2<T, P>& operator-=(U s);
GLM_FUNC_DECL tvec2<T, P>& operator-=(U scalar);
template <typename U>
GLM_FUNC_DECL tvec2<T, P>& operator-=(tvec1<U, P> const & v);
template <typename U>
GLM_FUNC_DECL tvec2<T, P>& operator-=(tvec2<U, P> const & v);
template <typename U>
GLM_FUNC_DECL tvec2<T, P>& operator*=(U s);
GLM_FUNC_DECL tvec2<T, P>& operator*=(U scalar);
template <typename U>
GLM_FUNC_DECL tvec2<T, P>& operator*=(tvec1<U, P> const & v);
template <typename U>
GLM_FUNC_DECL tvec2<T, P>& operator*=(tvec2<U, P> const & v);
template <typename U>
GLM_FUNC_DECL tvec2<T, P>& operator/=(U s);
GLM_FUNC_DECL tvec2<T, P>& operator/=(U scalar);
template <typename U>
GLM_FUNC_DECL tvec2<T, P>& operator/=(tvec1<U, P> const & v);
template <typename U>
@ -191,37 +198,37 @@ namespace glm
// -- Unary bit operators --
template <typename U>
GLM_FUNC_DECL tvec2<T, P> & operator%=(U s);
GLM_FUNC_DECL tvec2<T, P> & operator%=(U scalar);
template <typename U>
GLM_FUNC_DECL tvec2<T, P> & operator%=(tvec1<U, P> const & v);
template <typename U>
GLM_FUNC_DECL tvec2<T, P> & operator%=(tvec2<U, P> const & v);
template <typename U>
GLM_FUNC_DECL tvec2<T, P> & operator&=(U s);
GLM_FUNC_DECL tvec2<T, P> & operator&=(U scalar);
template <typename U>
GLM_FUNC_DECL tvec2<T, P> & operator&=(tvec1<U, P> const & v);
template <typename U>
GLM_FUNC_DECL tvec2<T, P> & operator&=(tvec2<U, P> const & v);
template <typename U>
GLM_FUNC_DECL tvec2<T, P> & operator|=(U s);
GLM_FUNC_DECL tvec2<T, P> & operator|=(U scalar);
template <typename U>
GLM_FUNC_DECL tvec2<T, P> & operator|=(tvec1<U, P> const & v);
template <typename U>
GLM_FUNC_DECL tvec2<T, P> & operator|=(tvec2<U, P> const & v);
template <typename U>
GLM_FUNC_DECL tvec2<T, P> & operator^=(U s);
GLM_FUNC_DECL tvec2<T, P> & operator^=(U scalar);
template <typename U>
GLM_FUNC_DECL tvec2<T, P> & operator^=(tvec1<U, P> const & v);
template <typename U>
GLM_FUNC_DECL tvec2<T, P> & operator^=(tvec2<U, P> const & v);
template <typename U>
GLM_FUNC_DECL tvec2<T, P> & operator<<=(U s);
GLM_FUNC_DECL tvec2<T, P> & operator<<=(U scalar);
template <typename U>
GLM_FUNC_DECL tvec2<T, P> & operator<<=(tvec1<U, P> const & v);
template <typename U>
GLM_FUNC_DECL tvec2<T, P> & operator<<=(tvec2<U, P> const & v);
template <typename U>
GLM_FUNC_DECL tvec2<T, P> & operator>>=(U s);
GLM_FUNC_DECL tvec2<T, P> & operator>>=(U scalar);
template <typename U>
GLM_FUNC_DECL tvec2<T, P> & operator>>=(tvec1<U, P> const & v);
template <typename U>
@ -236,13 +243,13 @@ namespace glm
// -- Binary operators --
template <typename T, precision P>
GLM_FUNC_DECL tvec2<T, P> operator+(tvec2<T, P> const & v, T const & s);
GLM_FUNC_DECL tvec2<T, P> operator+(tvec2<T, P> const & v, T const & scalar);
template <typename T, precision P>
GLM_FUNC_DECL tvec2<T, P> operator+(tvec2<T, P> const & v1, tvec1<T, P> const & v2);
template <typename T, precision P>
GLM_FUNC_DECL tvec2<T, P> operator+(T const & s, tvec2<T, P> const & v);
GLM_FUNC_DECL tvec2<T, P> operator+(T const & scalar, tvec2<T, P> const & v);
template <typename T, precision P>
GLM_FUNC_DECL tvec2<T, P> operator+(tvec1<T, P> const & v1, tvec2<T, P> const & v2);
@ -251,13 +258,13 @@ namespace glm
GLM_FUNC_DECL tvec2<T, P> operator+(tvec2<T, P> const & v1, tvec2<T, P> const & v2);
template <typename T, precision P>
GLM_FUNC_DECL tvec2<T, P> operator-(tvec2<T, P> const & v, T const & s);
GLM_FUNC_DECL tvec2<T, P> operator-(tvec2<T, P> const & v, T const & scalar);
template <typename T, precision P>
GLM_FUNC_DECL tvec2<T, P> operator-(tvec2<T, P> const & v1, tvec1<T, P> const & v2);
template <typename T, precision P>
GLM_FUNC_DECL tvec2<T, P> operator-(T const & s, tvec2<T, P> const & v);
GLM_FUNC_DECL tvec2<T, P> operator-(T const & scalar, tvec2<T, P> const & v);
template <typename T, precision P>
GLM_FUNC_DECL tvec2<T, P> operator-(tvec1<T, P> const & v1, tvec2<T, P> const & v2);
@ -266,13 +273,13 @@ namespace glm
GLM_FUNC_DECL tvec2<T, P> operator-(tvec2<T, P> const & v1, tvec2<T, P> const & v2);
template <typename T, precision P>
GLM_FUNC_DECL tvec2<T, P> operator*(tvec2<T, P> const & v, T const & s);
GLM_FUNC_DECL tvec2<T, P> operator*(tvec2<T, P> const & v, T const & scalar);
template <typename T, precision P>
GLM_FUNC_DECL tvec2<T, P> operator*(tvec2<T, P> const & v1, tvec1<T, P> const & v2);
template <typename T, precision P>
GLM_FUNC_DECL tvec2<T, P> operator*(T const & s, tvec2<T, P> const & v);
GLM_FUNC_DECL tvec2<T, P> operator*(T const & scalar, tvec2<T, P> const & v);
template <typename T, precision P>
GLM_FUNC_DECL tvec2<T, P> operator*(tvec1<T, P> const & v1, tvec2<T, P> const & v2);
@ -281,13 +288,13 @@ namespace glm
GLM_FUNC_DECL tvec2<T, P> operator*(tvec2<T, P> const & v1, tvec2<T, P> const & v2);
template <typename T, precision P>
GLM_FUNC_DECL tvec2<T, P> operator/(tvec2<T, P> const & v, T const & s);
GLM_FUNC_DECL tvec2<T, P> operator/(tvec2<T, P> const & v, T const & scalar);
template <typename T, precision P>
GLM_FUNC_DECL tvec2<T, P> operator/(tvec2<T, P> const & v1, tvec1<T, P> const & v2);
template <typename T, precision P>
GLM_FUNC_DECL tvec2<T, P> operator/(T const & s, tvec2<T, P> const & v);
GLM_FUNC_DECL tvec2<T, P> operator/(T const & scalar, tvec2<T, P> const & v);
template <typename T, precision P>
GLM_FUNC_DECL tvec2<T, P> operator/(tvec1<T, P> const & v1, tvec2<T, P> const & v2);
@ -299,13 +306,13 @@ namespace glm
GLM_FUNC_DECL tvec2<T, P> operator-(tvec2<T, P> const & v);
template <typename T, precision P>
GLM_FUNC_DECL tvec2<T, P> operator%(tvec2<T, P> const & v, T const & s);
GLM_FUNC_DECL tvec2<T, P> operator%(tvec2<T, P> const & v, T const & scalar);
template <typename T, precision P>
GLM_FUNC_DECL tvec2<T, P> operator%(tvec2<T, P> const & v1, tvec1<T, P> const & v2);
template <typename T, precision P>
GLM_FUNC_DECL tvec2<T, P> operator%(T const & s, tvec2<T, P> const & v);
GLM_FUNC_DECL tvec2<T, P> operator%(T const & scalar, tvec2<T, P> const & v);
template <typename T, precision P>
GLM_FUNC_DECL tvec2<T, P> operator%(tvec1<T, P> const & v1, tvec2<T, P> const & v2);
@ -314,13 +321,13 @@ namespace glm
GLM_FUNC_DECL tvec2<T, P> operator%(tvec2<T, P> const & v1, tvec2<T, P> const & v2);
template <typename T, precision P>
GLM_FUNC_DECL tvec2<T, P> operator&(tvec2<T, P> const & v, T const & s);
GLM_FUNC_DECL tvec2<T, P> operator&(tvec2<T, P> const & v, T const & scalar);
template <typename T, precision P>
GLM_FUNC_DECL tvec2<T, P> operator&(tvec2<T, P> const & v1, tvec1<T, P> const & v2);
template <typename T, precision P>
GLM_FUNC_DECL tvec2<T, P> operator&(T const & s, tvec2<T, P> const & v);
GLM_FUNC_DECL tvec2<T, P> operator&(T const & scalar, tvec2<T, P> const & v);
template <typename T, precision P>
GLM_FUNC_DECL tvec2<T, P> operator&(tvec1<T, P> const & v1, tvec2<T, P> const & v2);
@ -329,13 +336,13 @@ namespace glm
GLM_FUNC_DECL tvec2<T, P> operator&(tvec2<T, P> const & v1, tvec2<T, P> const & v2);
template <typename T, precision P>
GLM_FUNC_DECL tvec2<T, P> operator|(tvec2<T, P> const & v, T const & s);
GLM_FUNC_DECL tvec2<T, P> operator|(tvec2<T, P> const & v, T const & scalar);
template <typename T, precision P>
GLM_FUNC_DECL tvec2<T, P> operator|(tvec2<T, P> const & v1, tvec1<T, P> const & v2);
template <typename T, precision P>
GLM_FUNC_DECL tvec2<T, P> operator|(T const & s, tvec2<T, P> const & v);
GLM_FUNC_DECL tvec2<T, P> operator|(T const & scalar, tvec2<T, P> const & v);
template <typename T, precision P>
GLM_FUNC_DECL tvec2<T, P> operator|(tvec1<T, P> const & v1, tvec2<T, P> const & v2);
@ -344,13 +351,13 @@ namespace glm
GLM_FUNC_DECL tvec2<T, P> operator|(tvec2<T, P> const & v1, tvec2<T, P> const & v2);
template <typename T, precision P>
GLM_FUNC_DECL tvec2<T, P> operator^(tvec2<T, P> const & v, T const & s);
GLM_FUNC_DECL tvec2<T, P> operator^(tvec2<T, P> const & v, T const & scalar);
template <typename T, precision P>
GLM_FUNC_DECL tvec2<T, P> operator^(tvec2<T, P> const & v1, tvec1<T, P> const & v2);
template <typename T, precision P>
GLM_FUNC_DECL tvec2<T, P> operator^(T const & s, tvec2<T, P> const & v);
GLM_FUNC_DECL tvec2<T, P> operator^(T const & scalar, tvec2<T, P> const & v);
template <typename T, precision P>
GLM_FUNC_DECL tvec2<T, P> operator^(tvec1<T, P> const & v1, tvec2<T, P> const & v2);
@ -359,13 +366,13 @@ namespace glm
GLM_FUNC_DECL tvec2<T, P> operator^(tvec2<T, P> const & v1, tvec2<T, P> const & v2);
template <typename T, precision P>
GLM_FUNC_DECL tvec2<T, P> operator<<(tvec2<T, P> const & v, T const & s);
GLM_FUNC_DECL tvec2<T, P> operator<<(tvec2<T, P> const & v, T const & scalar);
template <typename T, precision P>
GLM_FUNC_DECL tvec2<T, P> operator<<(tvec2<T, P> const & v1, tvec1<T, P> const & v2);
template <typename T, precision P>
GLM_FUNC_DECL tvec2<T, P> operator<<(T const & s, tvec2<T, P> const & v);
GLM_FUNC_DECL tvec2<T, P> operator<<(T const & scalar, tvec2<T, P> const & v);
template <typename T, precision P>
GLM_FUNC_DECL tvec2<T, P> operator<<(tvec1<T, P> const & v1, tvec2<T, P> const & v2);
@ -374,13 +381,13 @@ namespace glm
GLM_FUNC_DECL tvec2<T, P> operator<<(tvec2<T, P> const & v1, tvec2<T, P> const & v2);
template <typename T, precision P>
GLM_FUNC_DECL tvec2<T, P> operator>>(tvec2<T, P> const & v, T const & s);
GLM_FUNC_DECL tvec2<T, P> operator>>(tvec2<T, P> const & v, T const & scalar);
template <typename T, precision P>
GLM_FUNC_DECL tvec2<T, P> operator>>(tvec2<T, P> const & v1, tvec1<T, P> const & v2);
template <typename T, precision P>
GLM_FUNC_DECL tvec2<T, P> operator>>(T const & s, tvec2<T, P> const & v);
GLM_FUNC_DECL tvec2<T, P> operator>>(T const & scalar, tvec2<T, P> const & v);
template <typename T, precision P>
GLM_FUNC_DECL tvec2<T, P> operator>>(tvec1<T, P> const & v1, tvec2<T, P> const & v2);
@ -398,6 +405,16 @@ namespace glm
template <typename T, precision P>
GLM_FUNC_DECL bool operator!=(tvec2<T, P> const & v1, tvec2<T, P> const & v2);
// -- Is type --
template <typename T, precision P>
struct type<T, P, tvec2>
{
static bool const is_vec = true;
static bool const is_mat = false;
static bool const is_quat = false;
};
}//namespace glm
#ifndef GLM_EXTERNAL_TEMPLATE

View File

@ -28,6 +28,19 @@
namespace glm
{
# ifdef GLM_STATIC_CONST_MEMBERS
template <typename T, precision P>
const tvec2<T, P> tvec2<T, P>::ZERO(static_cast<T>(0), static_cast<T>(0));
template <typename T, precision P>
const tvec2<T, P> tvec2<T, P>::X(static_cast<T>(1), static_cast<T>(0));
template <typename T, precision P>
const tvec2<T, P> tvec2<T, P>::Y(static_cast<T>(0), static_cast<T>(1));
template <typename T, precision P>
const tvec2<T, P> tvec2<T, P>::XY(static_cast<T>(1), static_cast<T>(1));
# endif
// -- Implicit basic constructors --
# if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT)
@ -59,8 +72,8 @@ namespace glm
{}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec2<T, P>::tvec2(T const & s)
: x(s), y(s)
GLM_FUNC_QUALIFIER tvec2<T, P>::tvec2(T const & scalar)
: x(scalar), y(scalar)
{}
template <typename T, precision P>
@ -174,10 +187,10 @@ namespace glm
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator+=(U s)
GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator+=(U scalar)
{
this->x += static_cast<T>(s);
this->y += static_cast<T>(s);
this->x += static_cast<T>(scalar);
this->y += static_cast<T>(scalar);
return *this;
}
@ -201,10 +214,10 @@ namespace glm
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator-=(U s)
GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator-=(U scalar)
{
this->x -= static_cast<T>(s);
this->y -= static_cast<T>(s);
this->x -= static_cast<T>(scalar);
this->y -= static_cast<T>(scalar);
return *this;
}
@ -228,10 +241,10 @@ namespace glm
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator*=(U s)
GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator*=(U scalar)
{
this->x *= static_cast<T>(s);
this->y *= static_cast<T>(s);
this->x *= static_cast<T>(scalar);
this->y *= static_cast<T>(scalar);
return *this;
}
@ -255,10 +268,10 @@ namespace glm
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator/=(U s)
GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator/=(U scalar)
{
this->x /= static_cast<T>(s);
this->y /= static_cast<T>(s);
this->x /= static_cast<T>(scalar);
this->y /= static_cast<T>(scalar);
return *this;
}
@ -318,10 +331,10 @@ namespace glm
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator%=(U s)
GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator%=(U scalar)
{
this->x %= static_cast<T>(s);
this->y %= static_cast<T>(s);
this->x %= static_cast<T>(scalar);
this->y %= static_cast<T>(scalar);
return *this;
}
@ -345,10 +358,10 @@ namespace glm
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator&=(U s)
GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator&=(U scalar)
{
this->x &= static_cast<T>(s);
this->y &= static_cast<T>(s);
this->x &= static_cast<T>(scalar);
this->y &= static_cast<T>(scalar);
return *this;
}
@ -372,10 +385,10 @@ namespace glm
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator|=(U s)
GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator|=(U scalar)
{
this->x |= static_cast<T>(s);
this->y |= static_cast<T>(s);
this->x |= static_cast<T>(scalar);
this->y |= static_cast<T>(scalar);
return *this;
}
@ -399,10 +412,10 @@ namespace glm
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator^=(U s)
GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator^=(U scalar)
{
this->x ^= static_cast<T>(s);
this->y ^= static_cast<T>(s);
this->x ^= static_cast<T>(scalar);
this->y ^= static_cast<T>(scalar);
return *this;
}
@ -426,10 +439,10 @@ namespace glm
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator<<=(U s)
GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator<<=(U scalar)
{
this->x <<= static_cast<T>(s);
this->y <<= static_cast<T>(s);
this->x <<= static_cast<T>(scalar);
this->y <<= static_cast<T>(scalar);
return *this;
}
@ -453,10 +466,10 @@ namespace glm
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator>>=(U s)
GLM_FUNC_QUALIFIER tvec2<T, P> & tvec2<T, P>::operator>>=(U scalar)
{
this->x >>= static_cast<T>(s);
this->y >>= static_cast<T>(s);
this->x >>= static_cast<T>(scalar);
this->y >>= static_cast<T>(scalar);
return *this;
}
@ -491,11 +504,11 @@ namespace glm
// -- Binary arithmetic operators --
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec2<T, P> operator+(tvec2<T, P> const & v, T const & s)
GLM_FUNC_QUALIFIER tvec2<T, P> operator+(tvec2<T, P> const & v, T const & scalar)
{
return tvec2<T, P>(
v.x + s,
v.y + s);
v.x + scalar,
v.y + scalar);
}
template <typename T, precision P>
@ -507,11 +520,11 @@ namespace glm
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec2<T, P> operator+(T const & s, tvec2<T, P> const & v)
GLM_FUNC_QUALIFIER tvec2<T, P> operator+(T const & scalar, tvec2<T, P> const & v)
{
return tvec2<T, P>(
s + v.x,
s + v.y);
scalar + v.x,
scalar + v.y);
}
template <typename T, precision P>
@ -531,11 +544,11 @@ namespace glm
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec2<T, P> operator-(tvec2<T, P> const & v, T const & s)
GLM_FUNC_QUALIFIER tvec2<T, P> operator-(tvec2<T, P> const & v, T const & scalar)
{
return tvec2<T, P>(
v.x - s,
v.y - s);
v.x - scalar,
v.y - scalar);
}
template <typename T, precision P>
@ -547,11 +560,11 @@ namespace glm
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec2<T, P> operator-(T const & s, tvec2<T, P> const & v)
GLM_FUNC_QUALIFIER tvec2<T, P> operator-(T const & scalar, tvec2<T, P> const & v)
{
return tvec2<T, P>(
s - v.x,
s - v.y);
scalar - v.x,
scalar - v.y);
}
template <typename T, precision P>
@ -587,11 +600,11 @@ namespace glm
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec2<T, P> operator*(T const & s, tvec2<T, P> const & v)
GLM_FUNC_QUALIFIER tvec2<T, P> operator*(T const & scalar, tvec2<T, P> const & v)
{
return tvec2<T, P>(
s * v.x,
s * v.y);
scalar * v.x,
scalar * v.y);
}
template <typename T, precision P>
@ -611,11 +624,11 @@ namespace glm
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec2<T, P> operator/(tvec2<T, P> const & v, T const & s)
GLM_FUNC_QUALIFIER tvec2<T, P> operator/(tvec2<T, P> const & v, T const & scalar)
{
return tvec2<T, P>(
v.x / s,
v.y / s);
v.x / scalar,
v.y / scalar);
}
template <typename T, precision P>
@ -627,11 +640,11 @@ namespace glm
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec2<T, P> operator/(T const & s, tvec2<T, P> const & v)
GLM_FUNC_QUALIFIER tvec2<T, P> operator/(T const & scalar, tvec2<T, P> const & v)
{
return tvec2<T, P>(
s / v.x,
s / v.y);
scalar / v.x,
scalar / v.y);
}
template <typename T, precision P>
@ -653,11 +666,11 @@ namespace glm
// -- Binary bit operators --
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec2<T, P> operator%(tvec2<T, P> const & v, T const & s)
GLM_FUNC_QUALIFIER tvec2<T, P> operator%(tvec2<T, P> const & v, T const & scalar)
{
return tvec2<T, P>(
v.x % s,
v.y % s);
v.x % scalar,
v.y % scalar);
}
template <typename T, precision P>
@ -669,11 +682,11 @@ namespace glm
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec2<T, P> operator%(T const & s, tvec2<T, P> const & v)
GLM_FUNC_QUALIFIER tvec2<T, P> operator%(T const & scalar, tvec2<T, P> const & v)
{
return tvec2<T, P>(
s % v.x,
s % v.y);
scalar % v.x,
scalar % v.y);
}
template <typename T, precision P>
@ -693,11 +706,11 @@ namespace glm
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec2<T, P> operator&(tvec2<T, P> const & v, T const & s)
GLM_FUNC_QUALIFIER tvec2<T, P> operator&(tvec2<T, P> const & v, T const & scalar)
{
return tvec2<T, P>(
v.x & s,
v.y & s);
v.x & scalar,
v.y & scalar);
}
template <typename T, precision P>
@ -709,11 +722,11 @@ namespace glm
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec2<T, P> operator&(T const & s, tvec2<T, P> const & v)
GLM_FUNC_QUALIFIER tvec2<T, P> operator&(T const & scalar, tvec2<T, P> const & v)
{
return tvec2<T, P>(
s & v.x,
s & v.y);
scalar & v.x,
scalar & v.y);
}
template <typename T, precision P>
@ -733,11 +746,11 @@ namespace glm
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec2<T, P> operator|(tvec2<T, P> const & v, T const & s)
GLM_FUNC_QUALIFIER tvec2<T, P> operator|(tvec2<T, P> const & v, T const & scalar)
{
return tvec2<T, P>(
v.x | s,
v.y | s);
v.x | scalar,
v.y | scalar);
}
template <typename T, precision P>
@ -749,11 +762,11 @@ namespace glm
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec2<T, P> operator|(T const & s, tvec2<T, P> const & v)
GLM_FUNC_QUALIFIER tvec2<T, P> operator|(T const & scalar, tvec2<T, P> const & v)
{
return tvec2<T, P>(
s | v.x,
s | v.y);
scalar | v.x,
scalar | v.y);
}
template <typename T, precision P>
@ -773,11 +786,11 @@ namespace glm
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec2<T, P> operator^(tvec2<T, P> const & v, T const & s)
GLM_FUNC_QUALIFIER tvec2<T, P> operator^(tvec2<T, P> const & v, T const & scalar)
{
return tvec2<T, P>(
v.x ^ s,
v.y ^ s);
v.x ^ scalar,
v.y ^ scalar);
}
template <typename T, precision P>
@ -789,11 +802,11 @@ namespace glm
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec2<T, P> operator^(T const & s, tvec2<T, P> const & v)
GLM_FUNC_QUALIFIER tvec2<T, P> operator^(T const & scalar, tvec2<T, P> const & v)
{
return tvec2<T, P>(
s ^ v.x,
s ^ v.y);
scalar ^ v.x,
scalar ^ v.y);
}
template <typename T, precision P>
@ -813,11 +826,11 @@ namespace glm
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec2<T, P> operator<<(tvec2<T, P> const & v, T const & s)
GLM_FUNC_QUALIFIER tvec2<T, P> operator<<(tvec2<T, P> const & v, T const & scalar)
{
return tvec2<T, P>(
v.x << s,
v.y << s);
v.x << scalar,
v.y << scalar);
}
template <typename T, precision P>
@ -829,11 +842,11 @@ namespace glm
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec2<T, P> operator<<(T const & s, tvec2<T, P> const & v)
GLM_FUNC_QUALIFIER tvec2<T, P> operator<<(T const & scalar, tvec2<T, P> const & v)
{
return tvec2<T, P>(
s << v.x,
s << v.y);
scalar << v.x,
scalar << v.y);
}
template <typename T, precision P>
@ -853,11 +866,11 @@ namespace glm
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec2<T, P> operator>>(tvec2<T, P> const & v, T const & s)
GLM_FUNC_QUALIFIER tvec2<T, P> operator>>(tvec2<T, P> const & v, T const & scalar)
{
return tvec2<T, P>(
v.x >> s,
v.y >> s);
v.x >> scalar,
v.y >> scalar);
}
template <typename T, precision P>
@ -869,11 +882,11 @@ namespace glm
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec2<T, P> operator>>(T const & s, tvec2<T, P> const & v)
GLM_FUNC_QUALIFIER tvec2<T, P> operator>>(T const & scalar, tvec2<T, P> const & v)
{
return tvec2<T, P>(
s >> v.x,
s >> v.y);
scalar >> v.x,
scalar >> v.y);
}
template <typename T, precision P>

View File

@ -58,6 +58,17 @@ namespace glm
static GLM_RELAXED_CONSTEXPR precision prec = P;
# endif//GLM_META_PROG_HELPERS
# ifdef GLM_STATIC_CONST_MEMBERS
static const type ZERO;
static const type X;
static const type Y;
static const type Z;
static const type XY;
static const type XZ;
static const type YZ;
static const type XYZ;
# endif
// -- Data --
# if GLM_HAS_ANONYMOUS_UNION
@ -117,7 +128,7 @@ namespace glm
// -- Explicit basic constructors --
GLM_FUNC_DECL explicit tvec3(ctor);
GLM_FUNC_DECL explicit tvec3(T const & s);
GLM_FUNC_DECL explicit tvec3(T const & scalar);
GLM_FUNC_DECL tvec3(T const & a, T const & b, T const & c);
// -- Conversion scalar constructors --
@ -160,15 +171,15 @@ namespace glm
}
template <int E0, int E1>
GLM_FUNC_DECL tvec3(detail::_swizzle<2, T, P, tvec2<T, P>, E0, E1, -1, -2> const & v, T const & s)
GLM_FUNC_DECL tvec3(detail::_swizzle<2, T, P, tvec2<T, P>, E0, E1, -1, -2> const & v, T const & scalar)
{
*this = tvec3<T, P>(v(), s);
*this = tvec3<T, P>(v(), scalar);
}
template <int E0, int E1>
GLM_FUNC_DECL tvec3(T const & s, detail::_swizzle<2, T, P, tvec2<T, P>, E0, E1, -1, -2> const & v)
GLM_FUNC_DECL tvec3(T const & scalar, detail::_swizzle<2, T, P, tvec2<T, P>, E0, E1, -1, -2> const & v)
{
*this = tvec3<T, P>(s, v());
*this = tvec3<T, P>(scalar, v());
}
# endif// GLM_HAS_ANONYMOUS_UNION && defined(GLM_SWIZZLE)
@ -179,25 +190,25 @@ namespace glm
template <typename U>
GLM_FUNC_DECL tvec3<T, P> & operator=(tvec3<U, P> const & v);
template <typename U>
GLM_FUNC_DECL tvec3<T, P> & operator+=(U s);
GLM_FUNC_DECL tvec3<T, P> & operator+=(U scalar);
template <typename U>
GLM_FUNC_DECL tvec3<T, P> & operator+=(tvec1<U, P> const & v);
template <typename U>
GLM_FUNC_DECL tvec3<T, P> & operator+=(tvec3<U, P> const & v);
template <typename U>
GLM_FUNC_DECL tvec3<T, P> & operator-=(U s);
GLM_FUNC_DECL tvec3<T, P> & operator-=(U scalar);
template <typename U>
GLM_FUNC_DECL tvec3<T, P> & operator-=(tvec1<U, P> const & v);
template <typename U>
GLM_FUNC_DECL tvec3<T, P> & operator-=(tvec3<U, P> const & v);
template <typename U>
GLM_FUNC_DECL tvec3<T, P> & operator*=(U s);
GLM_FUNC_DECL tvec3<T, P> & operator*=(U scalar);
template <typename U>
GLM_FUNC_DECL tvec3<T, P> & operator*=(tvec1<U, P> const & v);
template <typename U>
GLM_FUNC_DECL tvec3<T, P> & operator*=(tvec3<U, P> const & v);
template <typename U>
GLM_FUNC_DECL tvec3<T, P> & operator/=(U s);
GLM_FUNC_DECL tvec3<T, P> & operator/=(U scalar);
template <typename U>
GLM_FUNC_DECL tvec3<T, P> & operator/=(tvec1<U, P> const & v);
template <typename U>
@ -213,37 +224,37 @@ namespace glm
// -- Unary bit operators --
template <typename U>
GLM_FUNC_DECL tvec3<T, P> & operator%=(U s);
GLM_FUNC_DECL tvec3<T, P> & operator%=(U scalar);
template <typename U>
GLM_FUNC_DECL tvec3<T, P> & operator%=(tvec1<U, P> const & v);
template <typename U>
GLM_FUNC_DECL tvec3<T, P> & operator%=(tvec3<U, P> const & v);
template <typename U>
GLM_FUNC_DECL tvec3<T, P> & operator&=(U s);
GLM_FUNC_DECL tvec3<T, P> & operator&=(U scalar);
template <typename U>
GLM_FUNC_DECL tvec3<T, P> & operator&=(tvec1<U, P> const & v);
template <typename U>
GLM_FUNC_DECL tvec3<T, P> & operator&=(tvec3<U, P> const & v);
template <typename U>
GLM_FUNC_DECL tvec3<T, P> & operator|=(U s);
GLM_FUNC_DECL tvec3<T, P> & operator|=(U scalar);
template <typename U>
GLM_FUNC_DECL tvec3<T, P> & operator|=(tvec1<U, P> const & v);
template <typename U>
GLM_FUNC_DECL tvec3<T, P> & operator|=(tvec3<U, P> const & v);
template <typename U>
GLM_FUNC_DECL tvec3<T, P> & operator^=(U s);
GLM_FUNC_DECL tvec3<T, P> & operator^=(U scalar);
template <typename U>
GLM_FUNC_DECL tvec3<T, P> & operator^=(tvec1<U, P> const & v);
template <typename U>
GLM_FUNC_DECL tvec3<T, P> & operator^=(tvec3<U, P> const & v);
template <typename U>
GLM_FUNC_DECL tvec3<T, P> & operator<<=(U s);
GLM_FUNC_DECL tvec3<T, P> & operator<<=(U scalar);
template <typename U>
GLM_FUNC_DECL tvec3<T, P> & operator<<=(tvec1<U, P> const & v);
template <typename U>
GLM_FUNC_DECL tvec3<T, P> & operator<<=(tvec3<U, P> const & v);
template <typename U>
GLM_FUNC_DECL tvec3<T, P> & operator>>=(U s);
GLM_FUNC_DECL tvec3<T, P> & operator>>=(U scalar);
template <typename U>
GLM_FUNC_DECL tvec3<T, P> & operator>>=(tvec1<U, P> const & v);
template <typename U>
@ -258,151 +269,151 @@ namespace glm
// -- Binary operators --
template <typename T, precision P>
GLM_FUNC_DECL tvec3<T, P> operator+(tvec3<T, P> const & v, T const & s);
GLM_FUNC_DECL tvec3<T, P> operator+(tvec3<T, P> const & v, T const & scalar);
template <typename T, precision P>
GLM_FUNC_DECL tvec3<T, P> operator+(tvec3<T, P> const & v, tvec1<T, P> const & s);
GLM_FUNC_DECL tvec3<T, P> operator+(tvec3<T, P> const & v, tvec1<T, P> const & scalar);
template <typename T, precision P>
GLM_FUNC_DECL tvec3<T, P> operator+(T const & s, tvec3<T, P> const & v);
GLM_FUNC_DECL tvec3<T, P> operator+(T const & scalar, tvec3<T, P> const & v);
template <typename T, precision P>
GLM_FUNC_DECL tvec3<T, P> operator+(tvec1<T, P> const & s, tvec3<T, P> const & v);
GLM_FUNC_DECL tvec3<T, P> operator+(tvec1<T, P> const & scalar, tvec3<T, P> const & v);
template <typename T, precision P>
GLM_FUNC_DECL tvec3<T, P> operator+(tvec3<T, P> const & v1, tvec3<T, P> const & v2);
template <typename T, precision P>
GLM_FUNC_DECL tvec3<T, P> operator-(tvec3<T, P> const & v, T const & s);
GLM_FUNC_DECL tvec3<T, P> operator-(tvec3<T, P> const & v, T const & scalar);
template <typename T, precision P>
GLM_FUNC_DECL tvec3<T, P> operator-(tvec3<T, P> const & v, tvec1<T, P> const & s);
GLM_FUNC_DECL tvec3<T, P> operator-(tvec3<T, P> const & v, tvec1<T, P> const & scalar);
template <typename T, precision P>
GLM_FUNC_DECL tvec3<T, P> operator-(T const & s, tvec3<T, P> const & v);
GLM_FUNC_DECL tvec3<T, P> operator-(T const & scalar, tvec3<T, P> const & v);
template <typename T, precision P>
GLM_FUNC_DECL tvec3<T, P> operator-(tvec1<T, P> const & s, tvec3<T, P> const & v);
GLM_FUNC_DECL tvec3<T, P> operator-(tvec1<T, P> const & scalar, tvec3<T, P> const & v);
template <typename T, precision P>
GLM_FUNC_DECL tvec3<T, P> operator-(tvec3<T, P> const & v1, tvec3<T, P> const & v2);
template <typename T, precision P>
GLM_FUNC_DECL tvec3<T, P> operator*(tvec3<T, P> const & v, T const & s);
GLM_FUNC_DECL tvec3<T, P> operator*(tvec3<T, P> const & v, T const & scalar);
template <typename T, precision P>
GLM_FUNC_DECL tvec3<T, P> operator*(tvec3<T, P> const & v, tvec1<T, P> const & s);
GLM_FUNC_DECL tvec3<T, P> operator*(tvec3<T, P> const & v, tvec1<T, P> const & scalar);
template <typename T, precision P>
GLM_FUNC_DECL tvec3<T, P> operator*(T const & s, tvec3<T, P> const & v);
GLM_FUNC_DECL tvec3<T, P> operator*(T const & scalar, tvec3<T, P> const & v);
template <typename T, precision P>
GLM_FUNC_DECL tvec3<T, P> operator*(tvec1<T, P> const & s, tvec3<T, P> const & v);
GLM_FUNC_DECL tvec3<T, P> operator*(tvec1<T, P> const & scalar, tvec3<T, P> const & v);
template <typename T, precision P>
GLM_FUNC_DECL tvec3<T, P> operator*(tvec3<T, P> const & v1, tvec3<T, P> const & v2);
template <typename T, precision P>
GLM_FUNC_DECL tvec3<T, P> operator/(tvec3<T, P> const & v, T const & s);
GLM_FUNC_DECL tvec3<T, P> operator/(tvec3<T, P> const & v, T const & scalar);
template <typename T, precision P>
GLM_FUNC_DECL tvec3<T, P> operator/(tvec3<T, P> const & v, tvec1<T, P> const & s);
GLM_FUNC_DECL tvec3<T, P> operator/(tvec3<T, P> const & v, tvec1<T, P> const & scalar);
template <typename T, precision P>
GLM_FUNC_DECL tvec3<T, P> operator/(T const & s, tvec3<T, P> const & v);
GLM_FUNC_DECL tvec3<T, P> operator/(T const & scalar, tvec3<T, P> const & v);
template <typename T, precision P>
GLM_FUNC_DECL tvec3<T, P> operator/(tvec1<T, P> const & s, tvec3<T, P> const & v);
GLM_FUNC_DECL tvec3<T, P> operator/(tvec1<T, P> const & scalar, tvec3<T, P> const & v);
template <typename T, precision P>
GLM_FUNC_DECL tvec3<T, P> operator/(tvec3<T, P> const & v1, tvec3<T, P> const & v2);
template <typename T, precision P>
GLM_FUNC_DECL tvec3<T, P> operator%(tvec3<T, P> const & v, T const & s);
GLM_FUNC_DECL tvec3<T, P> operator%(tvec3<T, P> const & v, T const & scalar);
template <typename T, precision P>
GLM_FUNC_DECL tvec3<T, P> operator%(tvec3<T, P> const & v, tvec1<T, P> const & s);
GLM_FUNC_DECL tvec3<T, P> operator%(tvec3<T, P> const & v, tvec1<T, P> const & scalar);
template <typename T, precision P>
GLM_FUNC_DECL tvec3<T, P> operator%(T const & s, tvec3<T, P> const & v);
GLM_FUNC_DECL tvec3<T, P> operator%(T const & scalar, tvec3<T, P> const & v);
template <typename T, precision P>
GLM_FUNC_DECL tvec3<T, P> operator%(tvec1<T, P> const & s, tvec3<T, P> const & v);
GLM_FUNC_DECL tvec3<T, P> operator%(tvec1<T, P> const & scalar, tvec3<T, P> const & v);
template <typename T, precision P>
GLM_FUNC_DECL tvec3<T, P> operator%(tvec3<T, P> const & v1, tvec3<T, P> const & v2);
template <typename T, precision P>
GLM_FUNC_DECL tvec3<T, P> operator&(tvec3<T, P> const & v, T const & s);
GLM_FUNC_DECL tvec3<T, P> operator&(tvec3<T, P> const & v, T const & scalar);
template <typename T, precision P>
GLM_FUNC_DECL tvec3<T, P> operator&(tvec3<T, P> const & v, tvec1<T, P> const & s);
GLM_FUNC_DECL tvec3<T, P> operator&(tvec3<T, P> const & v, tvec1<T, P> const & scalar);
template <typename T, precision P>
GLM_FUNC_DECL tvec3<T, P> operator&(T const & s, tvec3<T, P> const & v);
GLM_FUNC_DECL tvec3<T, P> operator&(T const & scalar, tvec3<T, P> const & v);
template <typename T, precision P>
GLM_FUNC_DECL tvec3<T, P> operator&(tvec1<T, P> const & s, tvec3<T, P> const & v);
GLM_FUNC_DECL tvec3<T, P> operator&(tvec1<T, P> const & scalar, tvec3<T, P> const & v);
template <typename T, precision P>
GLM_FUNC_DECL tvec3<T, P> operator&(tvec3<T, P> const & v1, tvec3<T, P> const & v2);
template <typename T, precision P>
GLM_FUNC_DECL tvec3<T, P> operator|(tvec3<T, P> const & v, T const & s);
GLM_FUNC_DECL tvec3<T, P> operator|(tvec3<T, P> const & v, T const & scalar);
template <typename T, precision P>
GLM_FUNC_DECL tvec3<T, P> operator|(tvec3<T, P> const & v, tvec1<T, P> const & s);
GLM_FUNC_DECL tvec3<T, P> operator|(tvec3<T, P> const & v, tvec1<T, P> const & scalar);
template <typename T, precision P>
GLM_FUNC_DECL tvec3<T, P> operator|(T const & s, tvec3<T, P> const & v);
GLM_FUNC_DECL tvec3<T, P> operator|(T const & scalar, tvec3<T, P> const & v);
template <typename T, precision P>
GLM_FUNC_DECL tvec3<T, P> operator|(tvec1<T, P> const & s, tvec3<T, P> const & v);
GLM_FUNC_DECL tvec3<T, P> operator|(tvec1<T, P> const & scalar, tvec3<T, P> const & v);
template <typename T, precision P>
GLM_FUNC_DECL tvec3<T, P> operator|(tvec3<T, P> const & v1, tvec3<T, P> const & v2);
template <typename T, precision P>
GLM_FUNC_DECL tvec3<T, P> operator^(tvec3<T, P> const & v, T const & s);
GLM_FUNC_DECL tvec3<T, P> operator^(tvec3<T, P> const & v, T const & scalar);
template <typename T, precision P>
GLM_FUNC_DECL tvec3<T, P> operator^(tvec3<T, P> const & v, tvec1<T, P> const & s);
GLM_FUNC_DECL tvec3<T, P> operator^(tvec3<T, P> const & v, tvec1<T, P> const & scalar);
template <typename T, precision P>
GLM_FUNC_DECL tvec3<T, P> operator^(T const & s, tvec3<T, P> const & v);
GLM_FUNC_DECL tvec3<T, P> operator^(T const & scalar, tvec3<T, P> const & v);
template <typename T, precision P>
GLM_FUNC_DECL tvec3<T, P> operator^(tvec1<T, P> const & s, tvec3<T, P> const & v);
GLM_FUNC_DECL tvec3<T, P> operator^(tvec1<T, P> const & scalar, tvec3<T, P> const & v);
template <typename T, precision P>
GLM_FUNC_DECL tvec3<T, P> operator^(tvec3<T, P> const & v1, tvec3<T, P> const & v2);
template <typename T, precision P>
GLM_FUNC_DECL tvec3<T, P> operator<<(tvec3<T, P> const & v, T const & s);
GLM_FUNC_DECL tvec3<T, P> operator<<(tvec3<T, P> const & v, T const & scalar);
template <typename T, precision P>
GLM_FUNC_DECL tvec3<T, P> operator<<(tvec3<T, P> const & v, tvec1<T, P> const & s);
GLM_FUNC_DECL tvec3<T, P> operator<<(tvec3<T, P> const & v, tvec1<T, P> const & scalar);
template <typename T, precision P>
GLM_FUNC_DECL tvec3<T, P> operator<<(T const & s, tvec3<T, P> const & v);
GLM_FUNC_DECL tvec3<T, P> operator<<(T const & scalar, tvec3<T, P> const & v);
template <typename T, precision P>
GLM_FUNC_DECL tvec3<T, P> operator<<(tvec1<T, P> const & s, tvec3<T, P> const & v);
GLM_FUNC_DECL tvec3<T, P> operator<<(tvec1<T, P> const & scalar, tvec3<T, P> const & v);
template <typename T, precision P>
GLM_FUNC_DECL tvec3<T, P> operator<<(tvec3<T, P> const & v1, tvec3<T, P> const & v2);
template <typename T, precision P>
GLM_FUNC_DECL tvec3<T, P> operator>>(tvec3<T, P> const & v, T const & s);
GLM_FUNC_DECL tvec3<T, P> operator>>(tvec3<T, P> const & v, T const & scalar);
template <typename T, precision P>
GLM_FUNC_DECL tvec3<T, P> operator>>(tvec3<T, P> const & v, tvec1<T, P> const & s);
GLM_FUNC_DECL tvec3<T, P> operator>>(tvec3<T, P> const & v, tvec1<T, P> const & scalar);
template <typename T, precision P>
GLM_FUNC_DECL tvec3<T, P> operator>>(T const & s, tvec3<T, P> const & v);
GLM_FUNC_DECL tvec3<T, P> operator>>(T const & scalar, tvec3<T, P> const & v);
template <typename T, precision P>
GLM_FUNC_DECL tvec3<T, P> operator>>(tvec1<T, P> const & s, tvec3<T, P> const & v);
GLM_FUNC_DECL tvec3<T, P> operator>>(tvec1<T, P> const & scalar, tvec3<T, P> const & v);
template <typename T, precision P>
GLM_FUNC_DECL tvec3<T, P> operator>>(tvec3<T, P> const & v1, tvec3<T, P> const & v2);
@ -417,6 +428,16 @@ namespace glm
template <typename T, precision P>
GLM_FUNC_DECL bool operator!=(tvec3<T, P> const & v1, tvec3<T, P> const & v2);
// -- Is type --
template <typename T, precision P>
struct type<T, P, tvec3>
{
static bool const is_vec = true;
static bool const is_mat = false;
static bool const is_quat = false;
};
}//namespace glm
#ifndef GLM_EXTERNAL_TEMPLATE

View File

@ -32,6 +32,32 @@
namespace glm
{
# ifdef GLM_STATIC_CONST_MEMBERS
template <typename T, precision P>
const tvec3<T, P> tvec3<T, P>::ZERO(static_cast<T>(0), static_cast<T>(0), static_cast<T>(0));
template <typename T, precision P>
const tvec3<T, P> tvec3<T, P>::X(static_cast<T>(1), static_cast<T>(0), static_cast<T>(0));
template <typename T, precision P>
const tvec3<T, P> tvec3<T, P>::Y(static_cast<T>(0), static_cast<T>(1), static_cast<T>(0));
template <typename T, precision P>
const tvec3<T, P> tvec3<T, P>::Z(static_cast<T>(0), static_cast<T>(0), static_cast<T>(1));
template <typename T, precision P>
const tvec3<T, P> tvec3<T, P>::XY(static_cast<T>(1), static_cast<T>(1), static_cast<T>(0));
template <typename T, precision P>
const tvec3<T, P> tvec3<T, P>::XZ(static_cast<T>(1), static_cast<T>(0), static_cast<T>(1));
template <typename T, precision P>
const tvec3<T, P> tvec3<T, P>::YZ(static_cast<T>(0), static_cast<T>(1), static_cast<T>(1));
template <typename T, precision P>
const tvec3<T, P> tvec3<T, P>::XYZ(static_cast<T>(1), static_cast<T>(1), static_cast<T>(1));
# endif
// -- Implicit basic constructors --
# if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT)
@ -63,8 +89,8 @@ namespace glm
{}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec3<T, P>::tvec3(T const & s)
: x(s), y(s), z(s)
GLM_FUNC_QUALIFIER tvec3<T, P>::tvec3(T const & scalar)
: x(scalar), y(scalar), z(scalar)
{}
template <typename T, precision P>
@ -209,11 +235,11 @@ namespace glm
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec3<T, P> & tvec3<T, P>::operator+=(U s)
GLM_FUNC_QUALIFIER tvec3<T, P> & tvec3<T, P>::operator+=(U scalar)
{
this->x += static_cast<T>(s);
this->y += static_cast<T>(s);
this->z += static_cast<T>(s);
this->x += static_cast<T>(scalar);
this->y += static_cast<T>(scalar);
this->z += static_cast<T>(scalar);
return *this;
}
@ -239,11 +265,11 @@ namespace glm
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec3<T, P> & tvec3<T, P>::operator-=(U s)
GLM_FUNC_QUALIFIER tvec3<T, P> & tvec3<T, P>::operator-=(U scalar)
{
this->x -= static_cast<T>(s);
this->y -= static_cast<T>(s);
this->z -= static_cast<T>(s);
this->x -= static_cast<T>(scalar);
this->y -= static_cast<T>(scalar);
this->z -= static_cast<T>(scalar);
return *this;
}
@ -269,11 +295,11 @@ namespace glm
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec3<T, P> & tvec3<T, P>::operator*=(U s)
GLM_FUNC_QUALIFIER tvec3<T, P> & tvec3<T, P>::operator*=(U scalar)
{
this->x *= static_cast<T>(s);
this->y *= static_cast<T>(s);
this->z *= static_cast<T>(s);
this->x *= static_cast<T>(scalar);
this->y *= static_cast<T>(scalar);
this->z *= static_cast<T>(scalar);
return *this;
}
@ -299,11 +325,11 @@ namespace glm
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec3<T, P> & tvec3<T, P>::operator/=(U s)
GLM_FUNC_QUALIFIER tvec3<T, P> & tvec3<T, P>::operator/=(U v)
{
this->x /= static_cast<T>(s);
this->y /= static_cast<T>(s);
this->z /= static_cast<T>(s);
this->x /= static_cast<T>(v);
this->y /= static_cast<T>(v);
this->z /= static_cast<T>(v);
return *this;
}
@ -367,11 +393,11 @@ namespace glm
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec3<T, P> & tvec3<T, P>::operator%=(U s)
GLM_FUNC_QUALIFIER tvec3<T, P> & tvec3<T, P>::operator%=(U scalar)
{
this->x %= s;
this->y %= s;
this->z %= s;
this->x %= scalar;
this->y %= scalar;
this->z %= scalar;
return *this;
}
@ -397,11 +423,11 @@ namespace glm
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec3<T, P> & tvec3<T, P>::operator&=(U s)
GLM_FUNC_QUALIFIER tvec3<T, P> & tvec3<T, P>::operator&=(U scalar)
{
this->x &= s;
this->y &= s;
this->z &= s;
this->x &= scalar;
this->y &= scalar;
this->z &= scalar;
return *this;
}
@ -427,11 +453,11 @@ namespace glm
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec3<T, P> & tvec3<T, P>::operator|=(U s)
GLM_FUNC_QUALIFIER tvec3<T, P> & tvec3<T, P>::operator|=(U scalar)
{
this->x |= s;
this->y |= s;
this->z |= s;
this->x |= scalar;
this->y |= scalar;
this->z |= scalar;
return *this;
}
@ -457,11 +483,11 @@ namespace glm
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec3<T, P> & tvec3<T, P>::operator^=(U s)
GLM_FUNC_QUALIFIER tvec3<T, P> & tvec3<T, P>::operator^=(U scalar)
{
this->x ^= s;
this->y ^= s;
this->z ^= s;
this->x ^= scalar;
this->y ^= scalar;
this->z ^= scalar;
return *this;
}
@ -487,11 +513,11 @@ namespace glm
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec3<T, P> & tvec3<T, P>::operator<<=(U s)
GLM_FUNC_QUALIFIER tvec3<T, P> & tvec3<T, P>::operator<<=(U scalar)
{
this->x <<= s;
this->y <<= s;
this->z <<= s;
this->x <<= scalar;
this->y <<= scalar;
this->z <<= scalar;
return *this;
}
@ -517,11 +543,11 @@ namespace glm
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec3<T, P> & tvec3<T, P>::operator>>=(U s)
GLM_FUNC_QUALIFIER tvec3<T, P> & tvec3<T, P>::operator>>=(U scalar)
{
this->x >>= static_cast<T>(s);
this->y >>= static_cast<T>(s);
this->z >>= static_cast<T>(s);
this->x >>= static_cast<T>(scalar);
this->y >>= static_cast<T>(scalar);
this->z >>= static_cast<T>(scalar);
return *this;
}
@ -559,39 +585,39 @@ namespace glm
// -- Binary arithmetic operators --
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec3<T, P> operator+(tvec3<T, P> const & v, T const & s)
GLM_FUNC_QUALIFIER tvec3<T, P> operator+(tvec3<T, P> const & v, T const & scalar)
{
return tvec3<T, P>(
v.x + s,
v.y + s,
v.z + s);
v.x + scalar,
v.y + scalar,
v.z + scalar);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec3<T, P> operator+(tvec3<T, P> const & v, tvec1<T, P> const & s)
GLM_FUNC_QUALIFIER tvec3<T, P> operator+(tvec3<T, P> const & v, tvec1<T, P> const & scalar)
{
return tvec3<T, P>(
v.x + s.x,
v.y + s.x,
v.z + s.x);
v.x + scalar.x,
v.y + scalar.x,
v.z + scalar.x);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec3<T, P> operator+(T const & s, tvec3<T, P> const & v)
GLM_FUNC_QUALIFIER tvec3<T, P> operator+(T const & scalar, tvec3<T, P> const & v)
{
return tvec3<T, P>(
s + v.x,
s + v.y,
s + v.z);
scalar + v.x,
scalar + v.y,
scalar + v.z);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec3<T, P> operator+(tvec1<T, P> const & s, tvec3<T, P> const & v)
GLM_FUNC_QUALIFIER tvec3<T, P> operator+(tvec1<T, P> const & scalar, tvec3<T, P> const & v)
{
return tvec3<T, P>(
s.x + v.x,
s.x + v.y,
s.x + v.z);
scalar.x + v.x,
scalar.x + v.y,
scalar.x + v.z);
}
template <typename T, precision P>
@ -604,39 +630,39 @@ namespace glm
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec3<T, P> operator-(tvec3<T, P> const & v, T const & s)
GLM_FUNC_QUALIFIER tvec3<T, P> operator-(tvec3<T, P> const & v, T const & scalar)
{
return tvec3<T, P>(
v.x - s,
v.y - s,
v.z - s);
v.x - scalar,
v.y - scalar,
v.z - scalar);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec3<T, P> operator-(tvec3<T, P> const & v, tvec1<T, P> const & s)
GLM_FUNC_QUALIFIER tvec3<T, P> operator-(tvec3<T, P> const & v, tvec1<T, P> const & scalar)
{
return tvec3<T, P>(
v.x - s.x,
v.y - s.x,
v.z - s.x);
v.x - scalar.x,
v.y - scalar.x,
v.z - scalar.x);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec3<T, P> operator-(T const & s, tvec3<T, P> const & v)
GLM_FUNC_QUALIFIER tvec3<T, P> operator-(T const & scalar, tvec3<T, P> const & v)
{
return tvec3<T, P>(
s - v.x,
s - v.y,
s - v.z);
scalar - v.x,
scalar - v.y,
scalar - v.z);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec3<T, P> operator-(tvec1<T, P> const & s, tvec3<T, P> const & v)
GLM_FUNC_QUALIFIER tvec3<T, P> operator-(tvec1<T, P> const & scalar, tvec3<T, P> const & v)
{
return tvec3<T, P>(
s.x - v.x,
s.x - v.y,
s.x - v.z);
scalar.x - v.x,
scalar.x - v.y,
scalar.x - v.z);
}
template <typename T, precision P>
@ -649,39 +675,39 @@ namespace glm
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec3<T, P> operator*(tvec3<T, P> const & v, T const & s)
GLM_FUNC_QUALIFIER tvec3<T, P> operator*(tvec3<T, P> const & v, T const & scalar)
{
return tvec3<T, P>(
v.x * s,
v.y * s,
v.z * s);
v.x * scalar,
v.y * scalar,
v.z * scalar);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec3<T, P> operator*(tvec3<T, P> const & v, tvec1<T, P> const & s)
GLM_FUNC_QUALIFIER tvec3<T, P> operator*(tvec3<T, P> const & v, tvec1<T, P> const & scalar)
{
return tvec3<T, P>(
v.x * s.x,
v.y * s.x,
v.z * s.x);
v.x * scalar.x,
v.y * scalar.x,
v.z * scalar.x);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec3<T, P> operator*(T const & s, tvec3<T, P> const & v)
GLM_FUNC_QUALIFIER tvec3<T, P> operator*(T const & scalar, tvec3<T, P> const & v)
{
return tvec3<T, P>(
s * v.x,
s * v.y,
s * v.z);
scalar * v.x,
scalar * v.y,
scalar * v.z);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec3<T, P> operator*(tvec1<T, P> const & s, tvec3<T, P> const & v)
GLM_FUNC_QUALIFIER tvec3<T, P> operator*(tvec1<T, P> const & scalar, tvec3<T, P> const & v)
{
return tvec3<T, P>(
s.x * v.x,
s.x * v.y,
s.x * v.z);
scalar.x * v.x,
scalar.x * v.y,
scalar.x * v.z);
}
template <typename T, precision P>
@ -694,39 +720,39 @@ namespace glm
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec3<T, P> operator/(tvec3<T, P> const & v, T const & s)
GLM_FUNC_QUALIFIER tvec3<T, P> operator/(tvec3<T, P> const & v, T const & scalar)
{
return tvec3<T, P>(
v.x / s,
v.y / s,
v.z / s);
v.x / scalar,
v.y / scalar,
v.z / scalar);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec3<T, P> operator/(tvec3<T, P> const & v, tvec1<T, P> const & s)
GLM_FUNC_QUALIFIER tvec3<T, P> operator/(tvec3<T, P> const & v, tvec1<T, P> const & scalar)
{
return tvec3<T, P>(
v.x / s.x,
v.y / s.x,
v.z / s.x);
v.x / scalar.x,
v.y / scalar.x,
v.z / scalar.x);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec3<T, P> operator/(T const & s, tvec3<T, P> const & v)
GLM_FUNC_QUALIFIER tvec3<T, P> operator/(T const & scalar, tvec3<T, P> const & v)
{
return tvec3<T, P>(
s / v.x,
s / v.y,
s / v.z);
scalar / v.x,
scalar / v.y,
scalar / v.z);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec3<T, P> operator/(tvec1<T, P> const & s, tvec3<T, P> const & v)
GLM_FUNC_QUALIFIER tvec3<T, P> operator/(tvec1<T, P> const & scalar, tvec3<T, P> const & v)
{
return tvec3<T, P>(
s.x / v.x,
s.x / v.y,
s.x / v.z);
scalar.x / v.x,
scalar.x / v.y,
scalar.x / v.z);
}
template <typename T, precision P>
@ -741,39 +767,39 @@ namespace glm
// -- Binary bit operators --
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec3<T, P> operator%(tvec3<T, P> const & v, T const & s)
GLM_FUNC_QUALIFIER tvec3<T, P> operator%(tvec3<T, P> const & v, T const & scalar)
{
return tvec3<T, P>(
v.x % s,
v.y % s,
v.z % s);
v.x % scalar,
v.y % scalar,
v.z % scalar);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec3<T, P> operator%(tvec3<T, P> const & v, tvec1<T, P> const & s)
GLM_FUNC_QUALIFIER tvec3<T, P> operator%(tvec3<T, P> const & v, tvec1<T, P> const & scalar)
{
return tvec3<T, P>(
v.x % s.x,
v.y % s.x,
v.z % s.x);
v.x % scalar.x,
v.y % scalar.x,
v.z % scalar.x);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec3<T, P> operator%(T const & s, tvec3<T, P> const & v)
GLM_FUNC_QUALIFIER tvec3<T, P> operator%(T const & scalar, tvec3<T, P> const & v)
{
return tvec3<T, P>(
s % v.x,
s % v.y,
s % v.z);
scalar % v.x,
scalar % v.y,
scalar % v.z);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec3<T, P> operator%(tvec1<T, P> const & s, tvec3<T, P> const & v)
GLM_FUNC_QUALIFIER tvec3<T, P> operator%(tvec1<T, P> const & scalar, tvec3<T, P> const & v)
{
return tvec3<T, P>(
s.x % v.x,
s.x % v.y,
s.x % v.z);
scalar.x % v.x,
scalar.x % v.y,
scalar.x % v.z);
}
template <typename T, precision P>
@ -786,39 +812,39 @@ namespace glm
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec3<T, P> operator&(tvec3<T, P> const & v, T const & s)
GLM_FUNC_QUALIFIER tvec3<T, P> operator&(tvec3<T, P> const & v, T const & scalar)
{
return tvec3<T, P>(
v.x & s,
v.y & s,
v.z & s);
v.x & scalar,
v.y & scalar,
v.z & scalar);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec3<T, P> operator&(tvec3<T, P> const & v, tvec1<T, P> const & s)
GLM_FUNC_QUALIFIER tvec3<T, P> operator&(tvec3<T, P> const & v, tvec1<T, P> const & scalar)
{
return tvec3<T, P>(
v.x & s.x,
v.y & s.x,
v.z & s.x);
v.x & scalar.x,
v.y & scalar.x,
v.z & scalar.x);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec3<T, P> operator&(T const & s, tvec3<T, P> const & v)
GLM_FUNC_QUALIFIER tvec3<T, P> operator&(T const & scalar, tvec3<T, P> const & v)
{
return tvec3<T, P>(
s & v.x,
s & v.y,
s & v.z);
scalar & v.x,
scalar & v.y,
scalar & v.z);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec3<T, P> operator&(tvec1<T, P> const & s, tvec3<T, P> const & v)
GLM_FUNC_QUALIFIER tvec3<T, P> operator&(tvec1<T, P> const & scalar, tvec3<T, P> const & v)
{
return tvec3<T, P>(
s.x & v.x,
s.x & v.y,
s.x & v.z);
scalar.x & v.x,
scalar.x & v.y,
scalar.x & v.z);
}
template <typename T, precision P>
@ -831,39 +857,39 @@ namespace glm
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec3<T, P> operator|(tvec3<T, P> const & v, T const & s)
GLM_FUNC_QUALIFIER tvec3<T, P> operator|(tvec3<T, P> const & v, T const & scalar)
{
return tvec3<T, P>(
v.x | s,
v.y | s,
v.z | s);
v.x | scalar,
v.y | scalar,
v.z | scalar);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec3<T, P> operator|(tvec3<T, P> const & v, tvec1<T, P> const & s)
GLM_FUNC_QUALIFIER tvec3<T, P> operator|(tvec3<T, P> const & v, tvec1<T, P> const & scalar)
{
return tvec3<T, P>(
v.x | s.x,
v.y | s.x,
v.z | s.x);
v.x | scalar.x,
v.y | scalar.x,
v.z | scalar.x);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec3<T, P> operator|(T const & s, tvec3<T, P> const & v)
GLM_FUNC_QUALIFIER tvec3<T, P> operator|(T const & scalar, tvec3<T, P> const & v)
{
return tvec3<T, P>(
s | v.x,
s | v.y,
s | v.z);
scalar | v.x,
scalar | v.y,
scalar | v.z);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec3<T, P> operator|(tvec1<T, P> const & s, tvec3<T, P> const & v)
GLM_FUNC_QUALIFIER tvec3<T, P> operator|(tvec1<T, P> const & scalar, tvec3<T, P> const & v)
{
return tvec3<T, P>(
s.x | v.x,
s.x | v.y,
s.x | v.z);
scalar.x | v.x,
scalar.x | v.y,
scalar.x | v.z);
}
template <typename T, precision P>
@ -876,39 +902,39 @@ namespace glm
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec3<T, P> operator^(tvec3<T, P> const & v, T const & s)
GLM_FUNC_QUALIFIER tvec3<T, P> operator^(tvec3<T, P> const & v, T const & scalar)
{
return tvec3<T, P>(
v.x ^ s,
v.y ^ s,
v.z ^ s);
v.x ^ scalar,
v.y ^ scalar,
v.z ^ scalar);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec3<T, P> operator^(tvec3<T, P> const & v, tvec1<T, P> const & s)
GLM_FUNC_QUALIFIER tvec3<T, P> operator^(tvec3<T, P> const & v, tvec1<T, P> const & scalar)
{
return tvec3<T, P>(
v.x ^ s.x,
v.y ^ s.x,
v.z ^ s.x);
v.x ^ scalar.x,
v.y ^ scalar.x,
v.z ^ scalar.x);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec3<T, P> operator^(T const & s, tvec3<T, P> const & v)
GLM_FUNC_QUALIFIER tvec3<T, P> operator^(T const & scalar, tvec3<T, P> const & v)
{
return tvec3<T, P>(
s ^ v.x,
s ^ v.y,
s ^ v.z);
scalar ^ v.x,
scalar ^ v.y,
scalar ^ v.z);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec3<T, P> operator^(tvec1<T, P> const & s, tvec3<T, P> const & v)
GLM_FUNC_QUALIFIER tvec3<T, P> operator^(tvec1<T, P> const & scalar, tvec3<T, P> const & v)
{
return tvec3<T, P>(
s.x ^ v.x,
s.x ^ v.y,
s.x ^ v.z);
scalar.x ^ v.x,
scalar.x ^ v.y,
scalar.x ^ v.z);
}
template <typename T, precision P>
@ -921,39 +947,39 @@ namespace glm
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec3<T, P> operator<<(tvec3<T, P> const & v, T const & s)
GLM_FUNC_QUALIFIER tvec3<T, P> operator<<(tvec3<T, P> const & v, T const & scalar)
{
return tvec3<T, P>(
v.x << s,
v.y << s,
v.z << s);
v.x << scalar,
v.y << scalar,
v.z << scalar);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec3<T, P> operator<<(tvec3<T, P> const & v, tvec1<T, P> const & s)
GLM_FUNC_QUALIFIER tvec3<T, P> operator<<(tvec3<T, P> const & v, tvec1<T, P> const & scalar)
{
return tvec3<T, P>(
v.x << s.x,
v.y << s.x,
v.z << s.x);
v.x << scalar.x,
v.y << scalar.x,
v.z << scalar.x);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec3<T, P> operator<<(T const & s, tvec3<T, P> const & v)
GLM_FUNC_QUALIFIER tvec3<T, P> operator<<(T const & scalar, tvec3<T, P> const & v)
{
return tvec3<T, P>(
s << v.x,
s << v.y,
s << v.z);
scalar << v.x,
scalar << v.y,
scalar << v.z);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec3<T, P> operator<<(tvec1<T, P> const & s, tvec3<T, P> const & v)
GLM_FUNC_QUALIFIER tvec3<T, P> operator<<(tvec1<T, P> const & scalar, tvec3<T, P> const & v)
{
return tvec3<T, P>(
s.x << v.x,
s.x << v.y,
s.x << v.z);
scalar.x << v.x,
scalar.x << v.y,
scalar.x << v.z);
}
template <typename T, precision P>
@ -966,39 +992,39 @@ namespace glm
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec3<T, P> operator>>(tvec3<T, P> const & v, T const & s)
GLM_FUNC_QUALIFIER tvec3<T, P> operator>>(tvec3<T, P> const & v, T const & scalar)
{
return tvec3<T, P>(
v.x >> s,
v.y >> s,
v.z >> s);
v.x >> scalar,
v.y >> scalar,
v.z >> scalar);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec3<T, P> operator>>(tvec3<T, P> const & v, tvec1<T, P> const & s)
GLM_FUNC_QUALIFIER tvec3<T, P> operator>>(tvec3<T, P> const & v, tvec1<T, P> const & scalar)
{
return tvec3<T, P>(
v.x >> s.x,
v.y >> s.x,
v.z >> s.x);
v.x >> scalar.x,
v.y >> scalar.x,
v.z >> scalar.x);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec3<T, P> operator>>(T const & s, tvec3<T, P> const & v)
GLM_FUNC_QUALIFIER tvec3<T, P> operator>>(T const & scalar, tvec3<T, P> const & v)
{
return tvec3<T, P>(
s >> v.x,
s >> v.y,
s >> v.z);
scalar >> v.x,
scalar >> v.y,
scalar >> v.z);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec3<T, P> operator>>(tvec1<T, P> const & s, tvec3<T, P> const & v)
GLM_FUNC_QUALIFIER tvec3<T, P> operator>>(tvec1<T, P> const & scalar, tvec3<T, P> const & v)
{
return tvec3<T, P>(
s.x >> v.x,
s.x >> v.y,
s.x >> v.z);
scalar.x >> v.x,
scalar.x >> v.y,
scalar.x >> v.z);
}
template <typename T, precision P>

View File

@ -46,8 +46,8 @@
namespace glm{
namespace detail
{
template <typename T>
struct simd
template <typename T, precision P = defaultp>
struct simd_data
{
typedef T type[4];
};
@ -56,19 +56,19 @@ namespace detail
# if (GLM_ARCH & GLM_ARCH_SSE2) && GLM_NOT_BUGGY_VC32BITS
template <>
struct simd<float>
struct simd_data<float, simd>
{
typedef __m128 type;
};
template <>
struct simd<int>
struct simd_data<int, simd>
{
typedef __m128i type;
};
template <>
struct simd<unsigned int>
struct simd_data<unsigned int, simd>
{
typedef __m128i type;
};
@ -76,7 +76,7 @@ namespace detail
# if (GLM_ARCH & GLM_ARCH_AVX) && GLM_NOT_BUGGY_VC32BITS
template <>
struct simd<double>
struct simd_data<double, simd>
{
typedef __m256d type;
};
@ -84,13 +84,13 @@ namespace detail
# if (GLM_ARCH & GLM_ARCH_AVX2) && GLM_NOT_BUGGY_VC32BITS
template <>
struct simd<int64>
struct simd_data<int64, simd>
{
typedef __m256i type;
};
template <>
struct simd<uint64>
struct simd_data<uint64, simd>
{
typedef __m256i type;
};
@ -112,16 +112,35 @@ namespace detail
static GLM_RELAXED_CONSTEXPR precision prec = P;
# endif//GLM_META_PROG_HELPERS
# ifdef GLM_STATIC_CONST_MEMBERS
static const type ZERO;
static const type X;
static const type Y;
static const type Z;
static const type W;
static const type XY;
static const type XZ;
static const type XW;
static const type YZ;
static const type YW;
static const type ZW;
static const type XYZ;
static const type XYW;
static const type XZW;
static const type YZW;
static const type XYZW;
# endif
// -- Data --
# if GLM_HAS_ANONYMOUS_UNION
# if GLM_HAS_ANONYMOUS_UNION && GLM_NOT_BUGGY_VC32BITS
union
{
struct { T x, y, z, w;};
struct { T r, g, b, a; };
struct { T s, t, p, q; };
typename detail::simd<T>::type data;
typename detail::simd_data<T, P>::type data;
# ifdef GLM_SWIZZLE
_GLM_SWIZZLE4_2_MEMBERS(T, P, tvec2, x, y, z, w)
@ -174,7 +193,7 @@ namespace detail
// -- Explicit basic constructors --
GLM_FUNC_DECL explicit tvec4(ctor);
GLM_FUNC_DECL explicit tvec4(T s);
GLM_FUNC_DECL explicit tvec4(T scalar);
GLM_FUNC_DECL tvec4(T a, T b, T c, T d);
// -- Conversion scalar constructors --
@ -360,13 +379,13 @@ namespace detail
GLM_FUNC_DECL tvec4<T, P> operator+(tvec4<T, P> const & v, T scalar);
template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator+(tvec4<T, P> const & v, tvec1<T, P> const & s);
GLM_FUNC_DECL tvec4<T, P> operator+(tvec4<T, P> const & v, tvec1<T, P> const & scalar);
template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator+(T scalar, tvec4<T, P> const & v);
template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator+(tvec1<T, P> const & s, tvec4<T, P> const & v);
GLM_FUNC_DECL tvec4<T, P> operator+(tvec1<T, P> const & scalar, tvec4<T, P> const & v);
template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator+(tvec4<T, P> const & v1, tvec4<T, P> const & v2);
@ -375,13 +394,13 @@ namespace detail
GLM_FUNC_DECL tvec4<T, P> operator-(tvec4<T, P> const & v, T scalar);
template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator-(tvec4<T, P> const & v, tvec1<T, P> const & s);
GLM_FUNC_DECL tvec4<T, P> operator-(tvec4<T, P> const & v, tvec1<T, P> const & scalar);
template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator-(T scalar, tvec4<T, P> const & v);
template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator-(tvec1<T, P> const & s, tvec4<T, P> const & v);
GLM_FUNC_DECL tvec4<T, P> operator-(tvec1<T, P> const & scalar, tvec4<T, P> const & v);
template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator-(tvec4<T, P> const & v1, tvec4<T, P> const & v2);
@ -390,13 +409,13 @@ namespace detail
GLM_FUNC_DECL tvec4<T, P> operator*(tvec4<T, P> const & v, T scalar);
template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator*(tvec4<T, P> const & v, tvec1<T, P> const & s);
GLM_FUNC_DECL tvec4<T, P> operator*(tvec4<T, P> const & v, tvec1<T, P> const & scalar);
template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator*(T scalar, tvec4<T, P> const & v);
template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator*(tvec1<T, P> const & s, tvec4<T, P> const & v);
GLM_FUNC_DECL tvec4<T, P> operator*(tvec1<T, P> const & scalar, tvec4<T, P> const & v);
template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator*(tvec4<T, P> const & v1, tvec4<T, P> const & v2);
@ -405,13 +424,13 @@ namespace detail
GLM_FUNC_DECL tvec4<T, P> operator/(tvec4<T, P> const & v, T scalar);
template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator/(tvec4<T, P> const & v, tvec1<T, P> const & s);
GLM_FUNC_DECL tvec4<T, P> operator/(tvec4<T, P> const & v, tvec1<T, P> const & scalar);
template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator/(T scalar, tvec4<T, P> const & v);
template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator/(tvec1<T, P> const & s, tvec4<T, P> const & v);
GLM_FUNC_DECL tvec4<T, P> operator/(tvec1<T, P> const & scalar, tvec4<T, P> const & v);
template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator/(tvec4<T, P> const & v1, tvec4<T, P> const & v2);
@ -426,13 +445,13 @@ namespace detail
GLM_FUNC_DECL tvec4<T, P> operator%(tvec4<T, P> const & v, T scalar);
template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator%(tvec4<T, P> const & v, tvec1<T, P> const & s);
GLM_FUNC_DECL tvec4<T, P> operator%(tvec4<T, P> const & v, tvec1<T, P> const & scalar);
template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator%(T scalar, tvec4<T, P> const & v);
template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator%(tvec1<T, P> const & s, tvec4<T, P> const & v);
GLM_FUNC_DECL tvec4<T, P> operator%(tvec1<T, P> const & scalar, tvec4<T, P> const & v);
template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator%(tvec4<T, P> const & v1, tvec4<T, P> const & v2);
@ -441,13 +460,13 @@ namespace detail
GLM_FUNC_DECL tvec4<T, P> operator&(tvec4<T, P> const & v, T scalar);
template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator&(tvec4<T, P> const & v, tvec1<T, P> const & s);
GLM_FUNC_DECL tvec4<T, P> operator&(tvec4<T, P> const & v, tvec1<T, P> const & scalar);
template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator&(T scalar, tvec4<T, P> const & v);
template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator&(tvec1<T, P> const & s, tvec4<T, P> const & v);
GLM_FUNC_DECL tvec4<T, P> operator&(tvec1<T, P> const & scalar, tvec4<T, P> const & v);
template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator&(tvec4<T, P> const & v1, tvec4<T, P> const & v2);
@ -456,13 +475,13 @@ namespace detail
GLM_FUNC_DECL tvec4<T, P> operator|(tvec4<T, P> const & v, T scalar);
template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator|(tvec4<T, P> const & v, tvec1<T, P> const & s);
GLM_FUNC_DECL tvec4<T, P> operator|(tvec4<T, P> const & v, tvec1<T, P> const & scalar);
template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator|(T scalar, tvec4<T, P> const & v);
template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator|(tvec1<T, P> const & s, tvec4<T, P> const & v);
GLM_FUNC_DECL tvec4<T, P> operator|(tvec1<T, P> const & scalar, tvec4<T, P> const & v);
template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator|(tvec4<T, P> const & v1, tvec4<T, P> const & v2);
@ -471,13 +490,13 @@ namespace detail
GLM_FUNC_DECL tvec4<T, P> operator^(tvec4<T, P> const & v, T scalar);
template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator^(tvec4<T, P> const & v, tvec1<T, P> const & s);
GLM_FUNC_DECL tvec4<T, P> operator^(tvec4<T, P> const & v, tvec1<T, P> const & scalar);
template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator^(T scalar, tvec4<T, P> const & v);
template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator^(tvec1<T, P> const & s, tvec4<T, P> const & v);
GLM_FUNC_DECL tvec4<T, P> operator^(tvec1<T, P> const & scalar, tvec4<T, P> const & v);
template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator^(tvec4<T, P> const & v1, tvec4<T, P> const & v2);
@ -486,13 +505,13 @@ namespace detail
GLM_FUNC_DECL tvec4<T, P> operator<<(tvec4<T, P> const & v, T scalar);
template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator<<(tvec4<T, P> const & v, tvec1<T, P> const & s);
GLM_FUNC_DECL tvec4<T, P> operator<<(tvec4<T, P> const & v, tvec1<T, P> const & scalar);
template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator<<(T scalar, tvec4<T, P> const & v);
template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator<<(tvec1<T, P> const & s, tvec4<T, P> const & v);
GLM_FUNC_DECL tvec4<T, P> operator<<(tvec1<T, P> const & scalar, tvec4<T, P> const & v);
template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator<<(tvec4<T, P> const & v1, tvec4<T, P> const & v2);
@ -501,13 +520,13 @@ namespace detail
GLM_FUNC_DECL tvec4<T, P> operator>>(tvec4<T, P> const & v, T scalar);
template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator>>(tvec4<T, P> const & v, tvec1<T, P> const & s);
GLM_FUNC_DECL tvec4<T, P> operator>>(tvec4<T, P> const & v, tvec1<T, P> const & scalar);
template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator>>(T scalar, tvec4<T, P> const & v);
template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator>>(tvec1<T, P> const & s, tvec4<T, P> const & v);
GLM_FUNC_DECL tvec4<T, P> operator>>(tvec1<T, P> const & scalar, tvec4<T, P> const & v);
template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator>>(tvec4<T, P> const & v1, tvec4<T, P> const & v2);
@ -522,6 +541,16 @@ namespace detail
template <typename T, precision P>
GLM_FUNC_DECL bool operator!=(tvec4<T, P> const & v1, tvec4<T, P> const & v2);
// -- Is type --
template <typename T, precision P>
struct type<T, P, tvec4>
{
static bool const is_vec = true;
static bool const is_mat = false;
static bool const is_quat = false;
};
}//namespace glm
#ifndef GLM_EXTERNAL_TEMPLATE

View File

@ -32,6 +32,72 @@
namespace glm
{
# ifdef GLM_STATIC_CONST_MEMBERS
template <typename T, precision P>
const tvec4<T, P> tvec4<T, P>::ZERO
(static_cast<T>(0), static_cast<T>(0), static_cast<T>(0), static_cast<T>(0));
template <typename T, precision P>
const tvec4<T, P> tvec4<T, P>::X
(static_cast<T>(1), static_cast<T>(0), static_cast<T>(0), static_cast<T>(0));
template <typename T, precision P>
const tvec4<T, P> tvec4<T, P>::Y
(static_cast<T>(0), static_cast<T>(1), static_cast<T>(0), static_cast<T>(0));
template <typename T, precision P>
const tvec4<T, P> tvec4<T, P>::Z
(static_cast<T>(0), static_cast<T>(0), static_cast<T>(1), static_cast<T>(0));
template <typename T, precision P>
const tvec4<T, P> tvec4<T, P>::W
(static_cast<T>(0), static_cast<T>(0), static_cast<T>(0), static_cast<T>(1));
template <typename T, precision P>
const tvec4<T, P> tvec4<T, P>::XY
(static_cast<T>(1), static_cast<T>(1), static_cast<T>(0), static_cast<T>(0));
template <typename T, precision P>
const tvec4<T, P> tvec4<T, P>::XZ
(static_cast<T>(1), static_cast<T>(0), static_cast<T>(1), static_cast<T>(0));
template <typename T, precision P>
const tvec4<T, P> tvec4<T, P>::XW
(static_cast<T>(1), static_cast<T>(0), static_cast<T>(0), static_cast<T>(1));
template <typename T, precision P>
const tvec4<T, P> tvec4<T, P>::YZ
(static_cast<T>(0), static_cast<T>(1), static_cast<T>(1), static_cast<T>(0));
template <typename T, precision P>
const tvec4<T, P> tvec4<T, P>::YW
(static_cast<T>(0), static_cast<T>(1), static_cast<T>(0), static_cast<T>(1));
template <typename T, precision P>
const tvec4<T, P> tvec4<T, P>::ZW
(static_cast<T>(0), static_cast<T>(0), static_cast<T>(1), static_cast<T>(1));
template <typename T, precision P>
const tvec4<T, P> tvec4<T, P>::XYZ
(static_cast<T>(1), static_cast<T>(1), static_cast<T>(1), static_cast<T>(0));
template <typename T, precision P>
const tvec4<T, P> tvec4<T, P>::XYW
(static_cast<T>(1), static_cast<T>(1), static_cast<T>(0), static_cast<T>(1));
template <typename T, precision P>
const tvec4<T, P> tvec4<T, P>::XZW
(static_cast<T>(1), static_cast<T>(0), static_cast<T>(1), static_cast<T>(1));
template <typename T, precision P>
const tvec4<T, P> tvec4<T, P>::YZW
(static_cast<T>(0), static_cast<T>(1), static_cast<T>(1), static_cast<T>(1));
template <typename T, precision P>
const tvec4<T, P> tvec4<T, P>::XYZW
(static_cast<T>(1), static_cast<T>(1), static_cast<T>(1), static_cast<T>(1));
# endif
// -- Implicit basic constructors --
# if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT)
@ -63,8 +129,8 @@ namespace glm
{}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec4<T, P>::tvec4(T s)
: x(s), y(s), z(s), w(s)
GLM_FUNC_QUALIFIER tvec4<T, P>::tvec4(T scalar)
: x(scalar), y(scalar), z(scalar), w(scalar)
{}
template <typename T, precision P>
@ -341,12 +407,12 @@ namespace glm
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec4<T, P> & tvec4<T, P>::operator*=(U s)
GLM_FUNC_QUALIFIER tvec4<T, P> & tvec4<T, P>::operator*=(U v)
{
this->x *= static_cast<T>(s);
this->y *= static_cast<T>(s);
this->z *= static_cast<T>(s);
this->w *= static_cast<T>(s);
this->x *= static_cast<T>(v);
this->y *= static_cast<T>(v);
this->z *= static_cast<T>(v);
this->w *= static_cast<T>(v);
return *this;
}
@ -374,12 +440,12 @@ namespace glm
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec4<T, P> & tvec4<T, P>::operator/=(U s)
GLM_FUNC_QUALIFIER tvec4<T, P> & tvec4<T, P>::operator/=(U v)
{
this->x /= static_cast<T>(s);
this->y /= static_cast<T>(s);
this->z /= static_cast<T>(s);
this->w /= static_cast<T>(s);
this->x /= static_cast<T>(v);
this->y /= static_cast<T>(v);
this->z /= static_cast<T>(v);
this->w /= static_cast<T>(v);
return *this;
}
@ -780,43 +846,43 @@ namespace glm
// -- Binary bit operators --
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec4<T, P> operator%(tvec4<T, P> const & v, T s)
GLM_FUNC_QUALIFIER tvec4<T, P> operator%(tvec4<T, P> const & v, T scalar)
{
return tvec4<T, P>(
v.x % s,
v.y % s,
v.z % s,
v.w % s);
v.x % scalar,
v.y % scalar,
v.z % scalar,
v.w % scalar);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec4<T, P> operator%(tvec4<T, P> const & v, tvec1<T, P> const & s)
GLM_FUNC_QUALIFIER tvec4<T, P> operator%(tvec4<T, P> const & v, tvec1<T, P> const & scalar)
{
return tvec4<T, P>(
v.x % s.x,
v.y % s.x,
v.z % s.x,
v.w % s.x);
v.x % scalar.x,
v.y % scalar.x,
v.z % scalar.x,
v.w % scalar.x);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec4<T, P> operator%(T s, tvec4<T, P> const & v)
GLM_FUNC_QUALIFIER tvec4<T, P> operator%(T scalar, tvec4<T, P> const & v)
{
return tvec4<T, P>(
s % v.x,
s % v.y,
s % v.z,
s % v.w);
scalar % v.x,
scalar % v.y,
scalar % v.z,
scalar % v.w);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec4<T, P> operator%(tvec1<T, P> const & s, tvec4<T, P> const & v)
GLM_FUNC_QUALIFIER tvec4<T, P> operator%(tvec1<T, P> const & scalar, tvec4<T, P> const & v)
{
return tvec4<T, P>(
s.x % v.x,
s.x % v.y,
s.x % v.z,
s.x % v.w);
scalar.x % v.x,
scalar.x % v.y,
scalar.x % v.z,
scalar.x % v.w);
}
template <typename T, precision P>
@ -830,43 +896,43 @@ namespace glm
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec4<T, P> operator&(tvec4<T, P> const & v, T s)
GLM_FUNC_QUALIFIER tvec4<T, P> operator&(tvec4<T, P> const & v, T scalar)
{
return tvec4<T, P>(
v.x & s,
v.y & s,
v.z & s,
v.w & s);
v.x & scalar,
v.y & scalar,
v.z & scalar,
v.w & scalar);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec4<T, P> operator&(tvec4<T, P> const & v, tvec1<T, P> const & s)
GLM_FUNC_QUALIFIER tvec4<T, P> operator&(tvec4<T, P> const & v, tvec1<T, P> const & scalar)
{
return tvec4<T, P>(
v.x & s.x,
v.y & s.x,
v.z & s.x,
v.w & s.x);
v.x & scalar.x,
v.y & scalar.x,
v.z & scalar.x,
v.w & scalar.x);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec4<T, P> operator&(T s, tvec4<T, P> const & v)
GLM_FUNC_QUALIFIER tvec4<T, P> operator&(T scalar, tvec4<T, P> const & v)
{
return tvec4<T, P>(
s & v.x,
s & v.y,
s & v.z,
s & v.w);
scalar & v.x,
scalar & v.y,
scalar & v.z,
scalar & v.w);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec4<T, P> operator&(tvec1<T, P> const & s, tvec4<T, P> const & v)
GLM_FUNC_QUALIFIER tvec4<T, P> operator&(tvec1<T, P> const & scalar, tvec4<T, P> const & v)
{
return tvec4<T, P>(
s.x & v.x,
s.x & v.y,
s.x & v.z,
s.x & v.w);
scalar.x & v.x,
scalar.x & v.y,
scalar.x & v.z,
scalar.x & v.w);
}
template <typename T, precision P>
@ -880,43 +946,43 @@ namespace glm
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec4<T, P> operator|(tvec4<T, P> const & v, T s)
GLM_FUNC_QUALIFIER tvec4<T, P> operator|(tvec4<T, P> const & v, T scalar)
{
return tvec4<T, P>(
v.x | s,
v.y | s,
v.z | s,
v.w | s);
v.x | scalar,
v.y | scalar,
v.z | scalar,
v.w | scalar);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec4<T, P> operator|(tvec4<T, P> const & v, tvec1<T, P> const & s)
GLM_FUNC_QUALIFIER tvec4<T, P> operator|(tvec4<T, P> const & v, tvec1<T, P> const & scalar)
{
return tvec4<T, P>(
v.x | s.x,
v.y | s.x,
v.z | s.x,
v.w | s.x);
v.x | scalar.x,
v.y | scalar.x,
v.z | scalar.x,
v.w | scalar.x);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec4<T, P> operator|(T s, tvec4<T, P> const & v)
GLM_FUNC_QUALIFIER tvec4<T, P> operator|(T scalar, tvec4<T, P> const & v)
{
return tvec4<T, P>(
s | v.x,
s | v.y,
s | v.z,
s | v.w);
scalar | v.x,
scalar | v.y,
scalar | v.z,
scalar | v.w);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec4<T, P> operator|(tvec1<T, P> const & s, tvec4<T, P> const & v)
GLM_FUNC_QUALIFIER tvec4<T, P> operator|(tvec1<T, P> const & scalar, tvec4<T, P> const & v)
{
return tvec4<T, P>(
s.x | v.x,
s.x | v.y,
s.x | v.z,
s.x | v.w);
scalar.x | v.x,
scalar.x | v.y,
scalar.x | v.z,
scalar.x | v.w);
}
template <typename T, precision P>
@ -930,23 +996,23 @@ namespace glm
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec4<T, P> operator^(tvec4<T, P> const & v, T s)
GLM_FUNC_QUALIFIER tvec4<T, P> operator^(tvec4<T, P> const & v, T scalar)
{
return tvec4<T, P>(
v.x ^ s,
v.y ^ s,
v.z ^ s,
v.w ^ s);
v.x ^ scalar,
v.y ^ scalar,
v.z ^ scalar,
v.w ^ scalar);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec4<T, P> operator^(tvec4<T, P> const & v, tvec1<T, P> const & s)
GLM_FUNC_QUALIFIER tvec4<T, P> operator^(tvec4<T, P> const & v, tvec1<T, P> const & scalar)
{
return tvec4<T, P>(
v.x ^ s.x,
v.y ^ s.x,
v.z ^ s.x,
v.w ^ s.x);
v.x ^ scalar.x,
v.y ^ scalar.x,
v.z ^ scalar.x,
v.w ^ scalar.x);
}
template <typename T, precision P>
@ -960,13 +1026,13 @@ namespace glm
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec4<T, P> operator^(tvec1<T, P> const & s, tvec4<T, P> const & v)
GLM_FUNC_QUALIFIER tvec4<T, P> operator^(tvec1<T, P> const & scalar, tvec4<T, P> const & v)
{
return tvec4<T, P>(
s.x ^ v.x,
s.x ^ v.y,
s.x ^ v.z,
s.x ^ v.w);
scalar.x ^ v.x,
scalar.x ^ v.y,
scalar.x ^ v.z,
scalar.x ^ v.w);
}
template <typename T, precision P>
@ -990,13 +1056,13 @@ namespace glm
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec4<T, P> operator<<(tvec4<T, P> const & v, tvec1<T, P> const & s)
GLM_FUNC_QUALIFIER tvec4<T, P> operator<<(tvec4<T, P> const & v, tvec1<T, P> const & scalar)
{
return tvec4<T, P>(
v.x << s.x,
v.y << s.x,
v.z << s.x,
v.w << s.x);
v.x << scalar.x,
v.y << scalar.x,
v.z << scalar.x,
v.w << scalar.x);
}
template <typename T, precision P>
@ -1010,13 +1076,13 @@ namespace glm
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec4<T, P> operator<<(tvec1<T, P> const & s, tvec4<T, P> const & v)
GLM_FUNC_QUALIFIER tvec4<T, P> operator<<(tvec1<T, P> const & scalar, tvec4<T, P> const & v)
{
return tvec4<T, P>(
s.x << v.x,
s.x << v.y,
s.x << v.z,
s.x << v.w);
scalar.x << v.x,
scalar.x << v.y,
scalar.x << v.z,
scalar.x << v.w);
}
template <typename T, precision P>
@ -1040,13 +1106,13 @@ namespace glm
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec4<T, P> operator>>(tvec4<T, P> const & v, tvec1<T, P> const & s)
GLM_FUNC_QUALIFIER tvec4<T, P> operator>>(tvec4<T, P> const & v, tvec1<T, P> const & scalar)
{
return tvec4<T, P>(
v.x >> s.x,
v.y >> s.x,
v.z >> s.x,
v.w >> s.x);
v.x >> scalar.x,
v.y >> scalar.x,
v.z >> scalar.x,
v.w >> scalar.x);
}
template <typename T, precision P>
@ -1060,13 +1126,13 @@ namespace glm
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec4<T, P> operator>>(tvec1<T, P> const & s, tvec4<T, P> const & v)
GLM_FUNC_QUALIFIER tvec4<T, P> operator>>(tvec1<T, P> const & scalar, tvec4<T, P> const & v)
{
return tvec4<T, P>(
s.x >> v.x,
s.x >> v.y,
s.x >> v.z,
s.x >> v.w);
scalar.x >> v.x,
scalar.x >> v.y,
scalar.x >> v.z,
scalar.x >> v.w);
}
template <typename T, precision P>

View File

@ -34,14 +34,7 @@ namespace glm{
# if !GLM_HAS_DEFAULTED_FUNCTIONS
template <>
GLM_FUNC_QUALIFIER tvec4<float, lowp>::tvec4()
# ifndef GLM_FORCE_NO_CTOR_INIT
: data(_mm_setzero_ps())
# endif
{}
template <>
GLM_FUNC_QUALIFIER tvec4<float, mediump>::tvec4()
GLM_FUNC_QUALIFIER tvec4<float, simd>::tvec4()
# ifndef GLM_FORCE_NO_CTOR_INIT
: data(_mm_setzero_ps())
# endif
@ -49,28 +42,18 @@ namespace glm{
# endif//!GLM_HAS_DEFAULTED_FUNCTIONS
template <>
GLM_FUNC_QUALIFIER tvec4<float, lowp>::tvec4(float s) :
GLM_FUNC_QUALIFIER tvec4<float, simd>::tvec4(float s) :
data(_mm_set1_ps(s))
{}
template <>
GLM_FUNC_QUALIFIER tvec4<float, mediump>::tvec4(float s) :
data(_mm_set1_ps(s))
{}
template <>
GLM_FUNC_QUALIFIER tvec4<float, lowp>::tvec4(float a, float b, float c, float d) :
data(_mm_set_ps(d, c, b, a))
{}
template <>
GLM_FUNC_QUALIFIER tvec4<float, mediump>::tvec4(float a, float b, float c, float d) :
GLM_FUNC_QUALIFIER tvec4<float, simd>::tvec4(float a, float b, float c, float d) :
data(_mm_set_ps(d, c, b, a))
{}
template <>
template <typename U>
GLM_FUNC_QUALIFIER tvec4<float, lowp> & tvec4<float, lowp>::operator+=(U scalar)
GLM_FUNC_QUALIFIER tvec4<float, simd> & tvec4<float, simd>::operator+=(U scalar)
{
this->data = _mm_add_ps(this->data, _mm_set_ps1(static_cast<float>(scalar)));
return *this;
@ -78,7 +61,7 @@ namespace glm{
template <>
template <>
GLM_FUNC_QUALIFIER tvec4<float, lowp> & tvec4<float, lowp>::operator+=<float>(float scalar)
GLM_FUNC_QUALIFIER tvec4<float, simd> & tvec4<float, simd>::operator+=<float>(float scalar)
{
this->data = _mm_add_ps(this->data, _mm_set_ps1(scalar));
return *this;
@ -86,31 +69,7 @@ namespace glm{
template <>
template <typename U>
GLM_FUNC_QUALIFIER tvec4<float, mediump> & tvec4<float, mediump>::operator+=(U scalar)
{
this->data = _mm_add_ps(this->data, _mm_set_ps1(static_cast<float>(scalar)));
return *this;
}
template <>
template <>
GLM_FUNC_QUALIFIER tvec4<float, mediump> & tvec4<float, mediump>::operator+=<float>(float scalar)
{
this->data = _mm_add_ps(this->data, _mm_set_ps1(scalar));
return *this;
}
template <>
template <typename U>
GLM_FUNC_QUALIFIER tvec4<float, lowp> & tvec4<float, lowp>::operator+=(tvec1<U, lowp> const & v)
{
this->data = _mm_add_ps(this->data, _mm_set_ps1(static_cast<float>(v.x)));
return *this;
}
template <>
template <typename U>
GLM_FUNC_QUALIFIER tvec4<float, mediump> & tvec4<float, mediump>::operator+=(tvec1<U, mediump> const & v)
GLM_FUNC_QUALIFIER tvec4<float, simd> & tvec4<float, simd>::operator+=(tvec1<U, simd> const & v)
{
this->data = _mm_add_ps(this->data, _mm_set_ps1(static_cast<float>(v.x)));
return *this;

View File

@ -90,7 +90,7 @@
#include "./gtx/dual_quaternion.hpp"
#include "./gtx/euler_angles.hpp"
#include "./gtx/extend.hpp"
#include "./gtx/extented_min_max.hpp"
#include "./gtx/extended_min_max.hpp"
#include "./gtx/fast_exponential.hpp"
#include "./gtx/fast_square_root.hpp"
#include "./gtx/fast_trigonometry.hpp"

View File

@ -57,147 +57,147 @@ namespace glm
/// Return the epsilon constant for floating point types.
/// @see gtc_constants
template <typename genType>
GLM_FUNC_DECL genType epsilon();
GLM_FUNC_DECL GLM_CONSTEXPR genType epsilon();
/// Return 0.
/// @see gtc_constants
template <typename genType>
GLM_FUNC_DECL genType zero();
GLM_FUNC_DECL GLM_CONSTEXPR genType zero();
/// Return 1.
/// @see gtc_constants
template <typename genType>
GLM_FUNC_DECL genType one();
GLM_FUNC_DECL GLM_CONSTEXPR genType one();
/// Return the pi constant.
/// @see gtc_constants
template <typename genType>
GLM_FUNC_DECL genType pi();
GLM_FUNC_DECL GLM_CONSTEXPR genType pi();
/// Return pi * 2.
/// @see gtc_constants
template <typename genType>
GLM_FUNC_DECL genType two_pi();
GLM_FUNC_DECL GLM_CONSTEXPR genType two_pi();
/// Return square root of pi.
/// @see gtc_constants
template <typename genType>
GLM_FUNC_DECL genType root_pi();
GLM_FUNC_DECL GLM_CONSTEXPR genType root_pi();
/// Return pi / 2.
/// @see gtc_constants
template <typename genType>
GLM_FUNC_DECL genType half_pi();
GLM_FUNC_DECL GLM_CONSTEXPR genType half_pi();
/// Return pi / 2 * 3.
/// @see gtc_constants
template <typename genType>
GLM_FUNC_DECL genType three_over_two_pi();
GLM_FUNC_DECL GLM_CONSTEXPR genType three_over_two_pi();
/// Return pi / 4.
/// @see gtc_constants
template <typename genType>
GLM_FUNC_DECL genType quarter_pi();
GLM_FUNC_DECL GLM_CONSTEXPR genType quarter_pi();
/// Return 1 / pi.
/// @see gtc_constants
template <typename genType>
GLM_FUNC_DECL genType one_over_pi();
GLM_FUNC_DECL GLM_CONSTEXPR genType one_over_pi();
/// Return 1 / (pi * 2).
/// @see gtc_constants
template <typename genType>
GLM_FUNC_DECL genType one_over_two_pi();
GLM_FUNC_DECL GLM_CONSTEXPR genType one_over_two_pi();
/// Return 2 / pi.
/// @see gtc_constants
template <typename genType>
GLM_FUNC_DECL genType two_over_pi();
GLM_FUNC_DECL GLM_CONSTEXPR genType two_over_pi();
/// Return 4 / pi.
/// @see gtc_constants
template <typename genType>
GLM_FUNC_DECL genType four_over_pi();
GLM_FUNC_DECL GLM_CONSTEXPR genType four_over_pi();
/// Return 2 / sqrt(pi).
/// @see gtc_constants
template <typename genType>
GLM_FUNC_DECL genType two_over_root_pi();
GLM_FUNC_DECL GLM_CONSTEXPR genType two_over_root_pi();
/// Return 1 / sqrt(2).
/// @see gtc_constants
template <typename genType>
GLM_FUNC_DECL genType one_over_root_two();
GLM_FUNC_DECL GLM_CONSTEXPR genType one_over_root_two();
/// Return sqrt(pi / 2).
/// @see gtc_constants
template <typename genType>
GLM_FUNC_DECL genType root_half_pi();
GLM_FUNC_DECL GLM_CONSTEXPR genType root_half_pi();
/// Return sqrt(2 * pi).
/// @see gtc_constants
template <typename genType>
GLM_FUNC_DECL genType root_two_pi();
GLM_FUNC_DECL GLM_CONSTEXPR genType root_two_pi();
/// Return sqrt(ln(4)).
/// @see gtc_constants
template <typename genType>
GLM_FUNC_DECL genType root_ln_four();
GLM_FUNC_DECL GLM_CONSTEXPR genType root_ln_four();
/// Return e constant.
/// @see gtc_constants
template <typename genType>
GLM_FUNC_DECL genType e();
GLM_FUNC_DECL GLM_CONSTEXPR genType e();
/// Return Euler's constant.
/// @see gtc_constants
template <typename genType>
GLM_FUNC_DECL genType euler();
GLM_FUNC_DECL GLM_CONSTEXPR genType euler();
/// Return sqrt(2).
/// @see gtc_constants
template <typename genType>
GLM_FUNC_DECL genType root_two();
GLM_FUNC_DECL GLM_CONSTEXPR genType root_two();
/// Return sqrt(3).
/// @see gtc_constants
template <typename genType>
GLM_FUNC_DECL genType root_three();
GLM_FUNC_DECL GLM_CONSTEXPR genType root_three();
/// Return sqrt(5).
/// @see gtc_constants
template <typename genType>
GLM_FUNC_DECL genType root_five();
GLM_FUNC_DECL GLM_CONSTEXPR genType root_five();
/// Return ln(2).
/// @see gtc_constants
template <typename genType>
GLM_FUNC_DECL genType ln_two();
GLM_FUNC_DECL GLM_CONSTEXPR genType ln_two();
/// Return ln(10).
/// @see gtc_constants
template <typename genType>
GLM_FUNC_DECL genType ln_ten();
GLM_FUNC_DECL GLM_CONSTEXPR genType ln_ten();
/// Return ln(ln(2)).
/// @see gtc_constants
template <typename genType>
GLM_FUNC_DECL genType ln_ln_two();
GLM_FUNC_DECL GLM_CONSTEXPR genType ln_ln_two();
/// Return 1 / 3.
/// @see gtc_constants
template <typename genType>
GLM_FUNC_DECL genType third();
GLM_FUNC_DECL GLM_CONSTEXPR genType third();
/// Return 2 / 3.
/// @see gtc_constants
template <typename genType>
GLM_FUNC_DECL genType two_thirds();
GLM_FUNC_DECL GLM_CONSTEXPR genType two_thirds();
/// Return the golden ratio constant.
/// @see gtc_constants
template <typename genType>
GLM_FUNC_DECL genType golden_ratio();
GLM_FUNC_DECL GLM_CONSTEXPR genType golden_ratio();
/// @}
} //namespace glm

View File

@ -35,175 +35,175 @@
namespace glm
{
template <typename genType>
GLM_FUNC_QUALIFIER genType epsilon()
GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType epsilon()
{
return std::numeric_limits<genType>::epsilon();
}
template <typename genType>
GLM_FUNC_QUALIFIER genType zero()
GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType zero()
{
return genType(0);
}
template <typename genType>
GLM_FUNC_QUALIFIER genType one()
GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType one()
{
return genType(1);
}
template <typename genType>
GLM_FUNC_QUALIFIER genType pi()
GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType pi()
{
return genType(3.14159265358979323846264338327950288);
}
template <typename genType>
GLM_FUNC_QUALIFIER genType two_pi()
GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType two_pi()
{
return genType(6.28318530717958647692528676655900576);
}
template <typename genType>
GLM_FUNC_QUALIFIER genType root_pi()
GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType root_pi()
{
return genType(1.772453850905516027);
}
template <typename genType>
GLM_FUNC_QUALIFIER genType half_pi()
GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType half_pi()
{
return genType(1.57079632679489661923132169163975144);
}
template <typename genType>
GLM_FUNC_QUALIFIER genType three_over_two_pi()
GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType three_over_two_pi()
{
return genType(4.71238898038468985769396507491925432);
}
template <typename genType>
GLM_FUNC_QUALIFIER genType quarter_pi()
GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType quarter_pi()
{
return genType(0.785398163397448309615660845819875721);
}
template <typename genType>
GLM_FUNC_QUALIFIER genType one_over_pi()
GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType one_over_pi()
{
return genType(0.318309886183790671537767526745028724);
}
template <typename genType>
GLM_FUNC_QUALIFIER genType one_over_two_pi()
GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType one_over_two_pi()
{
return genType(0.159154943091895335768883763372514362);
}
template <typename genType>
GLM_FUNC_QUALIFIER genType two_over_pi()
GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType two_over_pi()
{
return genType(0.636619772367581343075535053490057448);
}
template <typename genType>
GLM_FUNC_QUALIFIER genType four_over_pi()
GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType four_over_pi()
{
return genType(1.273239544735162686151070106980114898);
}
template <typename genType>
GLM_FUNC_QUALIFIER genType two_over_root_pi()
GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType two_over_root_pi()
{
return genType(1.12837916709551257389615890312154517);
}
template <typename genType>
GLM_FUNC_QUALIFIER genType one_over_root_two()
GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType one_over_root_two()
{
return genType(0.707106781186547524400844362104849039);
}
template <typename genType>
GLM_FUNC_QUALIFIER genType root_half_pi()
GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType root_half_pi()
{
return genType(1.253314137315500251);
}
template <typename genType>
GLM_FUNC_QUALIFIER genType root_two_pi()
GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType root_two_pi()
{
return genType(2.506628274631000502);
}
template <typename genType>
GLM_FUNC_QUALIFIER genType root_ln_four()
GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType root_ln_four()
{
return genType(1.17741002251547469);
}
template <typename genType>
GLM_FUNC_QUALIFIER genType e()
GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType e()
{
return genType(2.71828182845904523536);
}
template <typename genType>
GLM_FUNC_QUALIFIER genType euler()
GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType euler()
{
return genType(0.577215664901532860606);
}
template <typename genType>
GLM_FUNC_QUALIFIER genType root_two()
GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType root_two()
{
return genType(1.41421356237309504880168872420969808);
}
template <typename genType>
GLM_FUNC_QUALIFIER genType root_three()
GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType root_three()
{
return genType(1.73205080756887729352744634150587236);
}
template <typename genType>
GLM_FUNC_QUALIFIER genType root_five()
GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType root_five()
{
return genType(2.23606797749978969640917366873127623);
}
template <typename genType>
GLM_FUNC_QUALIFIER genType ln_two()
GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType ln_two()
{
return genType(0.693147180559945309417232121458176568);
}
template <typename genType>
GLM_FUNC_QUALIFIER genType ln_ten()
GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType ln_ten()
{
return genType(2.30258509299404568401799145468436421);
}
template <typename genType>
GLM_FUNC_QUALIFIER genType ln_ln_two()
GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType ln_ln_two()
{
return genType(-0.3665129205816643);
}
template <typename genType>
GLM_FUNC_QUALIFIER genType third()
GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType third()
{
return genType(0.3333333333333333333333333333333333333333);
}
template <typename genType>
GLM_FUNC_QUALIFIER genType two_thirds()
GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType two_thirds()
{
return genType(0.666666666666666666666666666666666666667);
}
template <typename genType>
GLM_FUNC_QUALIFIER genType golden_ratio()
GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType golden_ratio()
{
return genType(1.61803398874989484820458683436563811);
}

View File

@ -35,23 +35,24 @@ namespace glm
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat3x3<T, P> affineInverse(tmat3x3<T, P> const & m)
{
tmat3x3<T, P> Result(m);
Result[2] = tvec3<T, P>(0, 0, 1);
Result = transpose(Result);
tvec3<T, P> Translation = Result * tvec3<T, P>(-tvec2<T, P>(m[2]), m[2][2]);
Result[2] = Translation;
return Result;
tmat2x2<T, P> const Inv(inverse(tmat2x2<T, P>(m)));
return tmat3x3<T, P>(
tvec3<T, P>(Inv[0], static_cast<T>(0)),
tvec3<T, P>(Inv[1], static_cast<T>(0)),
tvec3<T, P>(-Inv * tvec2<T, P>(m[2]), static_cast<T>(1)));
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tmat4x4<T, P> affineInverse(tmat4x4<T, P> const & m)
{
tmat4x4<T, P> Result(m);
Result[3] = tvec4<T, P>(0, 0, 0, 1);
Result = transpose(Result);
tvec4<T, P> Translation = Result * tvec4<T, P>(-tvec3<T, P>(m[3]), m[3][3]);
Result[3] = Translation;
return Result;
tmat3x3<T, P> const Inv(inverse(tmat3x3<T, P>(m)));
return tmat4x4<T, P>(
tvec4<T, P>(Inv[0], static_cast<T>(0)),
tvec4<T, P>(Inv[1], static_cast<T>(0)),
tvec4<T, P>(Inv[2], static_cast<T>(0)),
tvec4<T, P>(-Inv * tvec3<T, P>(m[3]), static_cast<T>(1)));
}
template <typename T, precision P>

View File

@ -186,7 +186,6 @@ namespace glm
T near,
T far);
/// Creates a matrix for a right handed, symetric perspective-view frustum.
///
/// @param fovy Specifies the field of view angle, in degrees, in the y direction. Expressed in radians.

View File

@ -472,6 +472,136 @@ namespace glm
/// @see uint32 packF2x11_1x10(vec3 const & v)
GLM_FUNC_DECL vec3 unpackF2x11_1x10(uint32 p);
/// First, converts the first two components of the normalized floating-point value v into 11-bit signless floating-point values.
/// Then, converts the third component of the normalized floating-point value v into a 10-bit signless floating-point value.
/// Then, the results are packed into the returned 32-bit unsigned integer.
///
/// The first vector component specifies the 11 least-significant bits of the result;
/// the last component specifies the 10 most-significant bits.
///
/// @see gtc_packing
/// @see vec3 unpackF3x9_E1x5(uint32 const & p)
GLM_FUNC_DECL uint32 packF3x9_E1x5(vec3 const & v);
/// First, unpacks a single 32-bit unsigned integer p into two 11-bit signless floating-point values and one 10-bit signless floating-point value .
/// Then, each component is converted to a normalized floating-point value to generate the returned three-component vector.
///
/// The first component of the returned vector will be extracted from the least significant bits of the input;
/// the last component will be extracted from the most significant bits.
///
/// @see gtc_packing
/// @see uint32 packF3x9_E1x5(vec3 const & v)
GLM_FUNC_DECL vec3 unpackF3x9_E1x5(uint32 p);
/// Returns an unsigned integer vector obtained by converting the components of a floating-point vector
/// to the 16-bit floating-point representation found in the OpenGL Specification.
/// The first vector component specifies the 16 least-significant bits of the result;
/// the forth component specifies the 16 most-significant bits.
///
/// @see gtc_packing
/// @see vecType<float, P> unpackHalf(vecType<uint16, P> const & p)
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
template <precision P, template <typename, precision> class vecType>
GLM_FUNC_DECL vecType<uint16, P> packHalf(vecType<float, P> const & v);
/// Returns a floating-point vector with components obtained by reinterpreting an integer vector as 16-bit floating-point numbers and converting them to 32-bit floating-point values.
/// The first component of the vector is obtained from the 16 least-significant bits of v;
/// the forth component is obtained from the 16 most-significant bits of v.
///
/// @see gtc_packing
/// @see vecType<uint16, P> packHalf(vecType<float, P> const & v)
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
template <precision P, template <typename, precision> class vecType>
GLM_FUNC_DECL vecType<float, P> unpackHalf(vecType<uint16, P> const & p);
/// Convert each component of the normalized floating-point vector into unsigned integer values.
///
/// @see gtc_packing
/// @see vecType<floatType, P> unpackUnorm(vecType<intType, P> const & p);
template <typename uintType, typename floatType, precision P, template <typename, precision> class vecType>
GLM_FUNC_DECL vecType<uintType, P> packUnorm(vecType<floatType, P> const & v);
/// Convert each unsigned integer components of a vector to normalized floating-point values.
///
/// @see gtc_packing
/// @see vecType<intType, P> packUnorm(vecType<floatType, P> const & v)
template <typename uintType, typename floatType, precision P, template <typename, precision> class vecType>
GLM_FUNC_DECL vecType<floatType, P> unpackUnorm(vecType<uintType, P> const & v);
/// Convert each component of the normalized floating-point vector into signed integer values.
///
/// @see gtc_packing
/// @see vecType<floatType, P> unpackSnorm(vecType<intType, P> const & p);
template <typename intType, typename floatType, precision P, template <typename, precision> class vecType>
GLM_FUNC_DECL vecType<intType, P> packSnorm(vecType<floatType, P> const & v);
/// Convert each signed integer components of a vector to normalized floating-point values.
///
/// @see gtc_packing
/// @see vecType<intType, P> packSnorm(vecType<floatType, P> const & v)
template <typename intType, typename floatType, precision P, template <typename, precision> class vecType>
GLM_FUNC_DECL vecType<floatType, P> unpackSnorm(vecType<intType, P> const & v);
/// Convert each component of the normalized floating-point vector into unsigned integer values.
///
/// @see gtc_packing
/// @see vec2 unpackUnorm2x4(uint8 p)
GLM_FUNC_DECL uint8 packUnorm2x4(vec2 const & v);
/// Convert each unsigned integer components of a vector to normalized floating-point values.
///
/// @see gtc_packing
/// @see uint8 packUnorm2x4(vec2 const & v)
GLM_FUNC_DECL vec2 unpackUnorm2x4(uint8 p);
/// Convert each component of the normalized floating-point vector into unsigned integer values.
///
/// @see gtc_packing
/// @see vec4 unpackUnorm4x4(uint16 p)
GLM_FUNC_DECL uint16 packUnorm4x4(vec4 const & v);
/// Convert each unsigned integer components of a vector to normalized floating-point values.
///
/// @see gtc_packing
/// @see uint16 packUnorm4x4(vec4 const & v)
GLM_FUNC_DECL vec4 unpackUnorm4x4(uint16 p);
/// Convert each component of the normalized floating-point vector into unsigned integer values.
///
/// @see gtc_packing
/// @see vec3 unpackUnorm1x5_1x6_1x5(uint16 p)
GLM_FUNC_DECL uint16 packUnorm1x5_1x6_1x5(vec3 const & v);
/// Convert each unsigned integer components of a vector to normalized floating-point values.
///
/// @see gtc_packing
/// @see uint16 packUnorm1x5_1x6_1x5(vec3 const & v)
GLM_FUNC_DECL vec3 unpackUnorm1x5_1x6_1x5(uint16 p);
/// Convert each component of the normalized floating-point vector into unsigned integer values.
///
/// @see gtc_packing
/// @see vec4 unpackUnorm3x5_1x1(uint16 p)
GLM_FUNC_DECL uint16 packUnorm3x5_1x1(vec4 const & v);
/// Convert each unsigned integer components of a vector to normalized floating-point values.
///
/// @see gtc_packing
/// @see uint16 packUnorm3x5_1x1(vec4 const & v)
GLM_FUNC_DECL vec4 unpackUnorm3x5_1x1(uint16 p);
/// Convert each component of the normalized floating-point vector into unsigned integer values.
///
/// @see gtc_packing
/// @see vec3 unpackUnorm2x3_1x2(uint8 p)
GLM_FUNC_DECL uint8 packUnorm2x3_1x2(vec3 const & v);
/// Convert each unsigned integer components of a vector to normalized floating-point values.
///
/// @see gtc_packing
/// @see uint8 packUnorm2x3_1x2(vec3 const & v)
GLM_FUNC_DECL vec3 unpackUnorm2x3_1x2(uint8 p);
/// @}
}// namespace glm

View File

@ -36,6 +36,7 @@
#include "../vec4.hpp"
#include "../detail/type_half.hpp"
#include <cstring>
#include <limits>
namespace glm{
namespace detail
@ -224,6 +225,62 @@ namespace detail
// return ((floatTo11bit(x) & ((1 << 11) - 1)) << 0) | ((floatTo11bit(y) & ((1 << 11) - 1)) << 11) | ((floatTo10bit(z) & ((1 << 10) - 1)) << 22);
// }
union u3u3u2
{
struct
{
uint x : 3;
uint y : 3;
uint z : 2;
} data;
uint8 pack;
};
union u4u4
{
struct
{
uint x : 4;
uint y : 4;
} data;
uint8 pack;
};
union u4u4u4u4
{
struct
{
uint x : 4;
uint y : 4;
uint z : 4;
uint w : 4;
} data;
uint16 pack;
};
union u5u6u5
{
struct
{
uint x : 5;
uint y : 6;
uint z : 5;
} data;
uint16 pack;
};
union u5u5u5u1
{
struct
{
uint x : 5;
uint y : 5;
uint z : 5;
uint w : 1;
} data;
uint16 pack;
};
union u10u10u10u2
{
struct
@ -248,6 +305,99 @@ namespace detail
uint32 pack;
};
union u9u9u9e5
{
struct
{
uint x : 9;
uint y : 9;
uint z : 9;
uint w : 5;
} data;
uint32 pack;
};
template <precision P, template <typename, precision> class vecType>
struct compute_half
{};
template <precision P>
struct compute_half<P, tvec1>
{
GLM_FUNC_QUALIFIER static tvec1<uint16, P> pack(tvec1<float, P> const & v)
{
int16 const Unpacked(detail::toFloat16(v.x));
return tvec1<uint16, P>(reinterpret_cast<uint16 const &>(Unpacked));
}
GLM_FUNC_QUALIFIER static tvec1<float, P> unpack(tvec1<uint16, P> const & v)
{
return tvec1<float, P>(detail::toFloat32(reinterpret_cast<int16 const &>(v.x)));
}
};
template <precision P>
struct compute_half<P, tvec2>
{
GLM_FUNC_QUALIFIER static tvec2<uint16, P> pack(tvec2<float, P> const & v)
{
tvec2<int16, P> const Unpacked(detail::toFloat16(v.x), detail::toFloat16(v.y));
return tvec2<uint16, P>(
reinterpret_cast<uint16 const &>(Unpacked.x),
reinterpret_cast<uint16 const &>(Unpacked.y));
}
GLM_FUNC_QUALIFIER static tvec2<float, P> unpack(tvec2<uint16, P> const & v)
{
return tvec2<float, P>(
detail::toFloat32(reinterpret_cast<int16 const &>(v.x)),
detail::toFloat32(reinterpret_cast<int16 const &>(v.y)));
}
};
template <precision P>
struct compute_half<P, tvec3>
{
GLM_FUNC_QUALIFIER static tvec3<uint16, P> pack(tvec3<float, P> const & v)
{
tvec3<int16, P> const Unpacked(detail::toFloat16(v.x), detail::toFloat16(v.y), detail::toFloat16(v.z));
return tvec3<uint16, P>(
reinterpret_cast<uint16 const &>(Unpacked.x),
reinterpret_cast<uint16 const &>(Unpacked.y),
reinterpret_cast<uint16 const &>(Unpacked.z));
}
GLM_FUNC_QUALIFIER static tvec3<float, P> unpack(tvec3<uint16, P> const & v)
{
return tvec3<float, P>(
detail::toFloat32(reinterpret_cast<int16 const &>(v.x)),
detail::toFloat32(reinterpret_cast<int16 const &>(v.y)),
detail::toFloat32(reinterpret_cast<int16 const &>(v.z)));
}
};
template <precision P>
struct compute_half<P, tvec4>
{
GLM_FUNC_QUALIFIER static tvec4<uint16, P> pack(tvec4<float, P> const & v)
{
tvec4<int16, P> const Unpacked(detail::toFloat16(v.x), detail::toFloat16(v.y), detail::toFloat16(v.z), detail::toFloat16(v.w));
return tvec4<uint16, P>(
reinterpret_cast<uint16 const &>(Unpacked.x),
reinterpret_cast<uint16 const &>(Unpacked.y),
reinterpret_cast<uint16 const &>(Unpacked.z),
reinterpret_cast<uint16 const &>(Unpacked.w));
}
GLM_FUNC_QUALIFIER static tvec4<float, P> unpack(tvec4<uint16, P> const & v)
{
return tvec4<float, P>(
detail::toFloat32(reinterpret_cast<int16 const &>(v.x)),
detail::toFloat32(reinterpret_cast<int16 const &>(v.y)),
detail::toFloat32(reinterpret_cast<int16 const &>(v.z)),
detail::toFloat32(reinterpret_cast<int16 const &>(v.w)));
}
};
}//namespace detail
GLM_FUNC_QUALIFIER uint8 packUnorm1x8(float v)
@ -451,24 +601,23 @@ namespace detail
GLM_FUNC_QUALIFIER uint32 packUnorm3x10_1x2(vec4 const & v)
{
detail::i10i10i10i2 Result;
Result.data.x = int(round(clamp(v.x, 0.0f, 1.0f) * 1023.f));
Result.data.y = int(round(clamp(v.y, 0.0f, 1.0f) * 1023.f));
Result.data.z = int(round(clamp(v.z, 0.0f, 1.0f) * 1023.f));
Result.data.w = int(round(clamp(v.w, 0.0f, 1.0f) * 3.f));
uvec4 const Unpack(round(clamp(v, 0.0f, 1.0f) * vec4(1023.f, 1023.f, 1023.f, 3.f)));
detail::u10u10u10u2 Result;
Result.data.x = Unpack.x;
Result.data.y = Unpack.y;
Result.data.z = Unpack.z;
Result.data.w = Unpack.w;
return Result.pack;
}
GLM_FUNC_QUALIFIER vec4 unpackUnorm3x10_1x2(uint32 v)
{
detail::i10i10i10i2 Unpack;
vec4 const ScaleFactors(1.0f / 1023.f, 1.0f / 1023.f, 1.0f / 1023.f, 1.0f / 3.f);
detail::u10u10u10u2 Unpack;
Unpack.pack = v;
vec4 Result;
Result.x = float(Unpack.data.x) / 1023.f;
Result.y = float(Unpack.data.y) / 1023.f;
Result.z = float(Unpack.data.z) / 1023.f;
Result.w = float(Unpack.data.w) / 3.f;
return Result;
return vec4(Unpack.data.x, Unpack.data.y, Unpack.data.z, Unpack.data.w) * ScaleFactors;
}
GLM_FUNC_QUALIFIER uint32 packF2x11_1x10(vec3 const & v)
@ -487,4 +636,171 @@ namespace detail
detail::packed10bitToFloat(v >> 22));
}
GLM_FUNC_QUALIFIER uint32 packF3x9_E1x5(vec3 const & v)
{
float const SharedExpMax = (pow(2.0f, 9.0f - 1.0f) / pow(2.0f, 9.0f)) * pow(2.0f, 31.f - 15.f);
vec3 const Color = clamp(v, 0.0f, SharedExpMax);
float const MaxColor = max(Color.x, max(Color.y, Color.z));
float const ExpSharedP = max(-15.f - 1.f, floor(log2(MaxColor))) + 1.0f + 15.f;
float const MaxShared = floor(MaxColor / pow(2.0f, (ExpSharedP - 16.f - 9.f)) + 0.5f);
float const ExpShared = MaxShared == pow(2.0f, 9.0f) ? ExpSharedP + 1.0f : ExpSharedP;
uvec3 const ColorComp(floor(Color / pow(2.f, (ExpShared - 15.f - 9.f)) + 0.5f));
detail::u9u9u9e5 Unpack;
Unpack.data.x = ColorComp.x;
Unpack.data.y = ColorComp.y;
Unpack.data.z = ColorComp.z;
Unpack.data.w = uint(ExpShared);
return Unpack.pack;
}
GLM_FUNC_QUALIFIER vec3 unpackF3x9_E1x5(uint32 v)
{
detail::u9u9u9e5 Unpack;
Unpack.pack = v;
return vec3(Unpack.data.x, Unpack.data.y, Unpack.data.z) * pow(2.0f, Unpack.data.w - 15.f - 9.f);
}
template <precision P, template <typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<uint16, P> packHalf(vecType<float, P> const & v)
{
return detail::compute_half<P, vecType>::pack(v);
}
template <precision P, template <typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<float, P> unpackHalf(vecType<uint16, P> const & v)
{
return detail::compute_half<P, vecType>::unpack(v);
}
template <typename uintType, typename floatType, precision P, template <typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<uintType, P> packUnorm(vecType<floatType, P> const & v)
{
GLM_STATIC_ASSERT(std::numeric_limits<uintType>::is_integer, "uintType must be an integer type");
GLM_STATIC_ASSERT(std::numeric_limits<floatType>::is_iec559, "floatType must be a floating point type");
return vecType<uintType, P>(round(clamp(v, static_cast<floatType>(0), static_cast<floatType>(1)) * static_cast<floatType>(std::numeric_limits<uintType>::max())));
}
template <typename uintType, typename floatType, precision P, template <typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<floatType, P> unpackUnorm(vecType<uintType, P> const & v)
{
GLM_STATIC_ASSERT(std::numeric_limits<uintType>::is_integer, "uintType must be an integer type");
GLM_STATIC_ASSERT(std::numeric_limits<floatType>::is_iec559, "floatType must be a floating point type");
return vecType<float, P>(v) * (static_cast<floatType>(1) / static_cast<floatType>(std::numeric_limits<uintType>::max()));
}
template <typename intType, typename floatType, precision P, template <typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<intType, P> packSnorm(vecType<floatType, P> const & v)
{
GLM_STATIC_ASSERT(std::numeric_limits<intType>::is_integer, "uintType must be an integer type");
GLM_STATIC_ASSERT(std::numeric_limits<floatType>::is_iec559, "floatType must be a floating point type");
return vecType<intType, P>(round(clamp(v , static_cast<floatType>(-1), static_cast<floatType>(1)) * static_cast<floatType>(std::numeric_limits<intType>::max())));
}
template <typename intType, typename floatType, precision P, template <typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<floatType, P> unpackSnorm(vecType<intType, P> const & v)
{
GLM_STATIC_ASSERT(std::numeric_limits<intType>::is_integer, "uintType must be an integer type");
GLM_STATIC_ASSERT(std::numeric_limits<floatType>::is_iec559, "floatType must be a floating point type");
return clamp(vecType<floatType, P>(v) * (static_cast<floatType>(1) / static_cast<floatType>(std::numeric_limits<intType>::max())), static_cast<floatType>(-1), static_cast<floatType>(1));
}
GLM_FUNC_QUALIFIER uint8 packUnorm2x4(vec2 const & v)
{
u32vec2 const Unpack(round(clamp(v, 0.0f, 1.0f) * 15.0f));
detail::u4u4 Result;
Result.data.x = Unpack.x;
Result.data.y = Unpack.y;
return Result.pack;
}
GLM_FUNC_QUALIFIER vec2 unpackUnorm2x4(uint8 v)
{
float const ScaleFactor(1.f / 15.f);
detail::u4u4 Unpack;
Unpack.pack = v;
return vec2(Unpack.data.x, Unpack.data.y) * ScaleFactor;
}
GLM_FUNC_QUALIFIER uint16 packUnorm4x4(vec4 const & v)
{
u32vec4 const Unpack(round(clamp(v, 0.0f, 1.0f) * 15.0f));
detail::u4u4u4u4 Result;
Result.data.x = Unpack.x;
Result.data.y = Unpack.y;
Result.data.z = Unpack.z;
Result.data.w = Unpack.w;
return Result.pack;
}
GLM_FUNC_QUALIFIER vec4 unpackUnorm4x4(uint16 v)
{
float const ScaleFactor(1.f / 15.f);
detail::u4u4u4u4 Unpack;
Unpack.pack = v;
return vec4(Unpack.data.x, Unpack.data.y, Unpack.data.z, Unpack.data.w) * ScaleFactor;
}
GLM_FUNC_QUALIFIER uint16 packUnorm1x5_1x6_1x5(vec3 const & v)
{
u32vec3 const Unpack(round(clamp(v, 0.0f, 1.0f) * vec3(15.f, 31.f, 15.f)));
detail::u5u6u5 Result;
Result.data.x = Unpack.x;
Result.data.y = Unpack.y;
Result.data.z = Unpack.z;
return Result.pack;
}
GLM_FUNC_QUALIFIER vec3 unpackUnorm1x5_1x6_1x5(uint16 v)
{
vec3 const ScaleFactor(1.f / 15.f, 1.f / 31.f, 1.f / 15.f);
detail::u5u6u5 Unpack;
Unpack.pack = v;
return vec3(Unpack.data.x, Unpack.data.y, Unpack.data.z) * ScaleFactor;
}
GLM_FUNC_QUALIFIER uint16 packUnorm3x5_1x1(vec4 const & v)
{
u32vec4 const Unpack(round(clamp(v, 0.0f, 1.0f) * vec4(15.f, 15.f, 15.f, 1.f)));
detail::u5u5u5u1 Result;
Result.data.x = Unpack.x;
Result.data.y = Unpack.y;
Result.data.z = Unpack.z;
Result.data.w = Unpack.w;
return Result.pack;
}
GLM_FUNC_QUALIFIER vec4 unpackUnorm3x5_1x1(uint16 v)
{
vec4 const ScaleFactor(1.f / 15.f, 1.f / 15.f, 1.f / 15.f, 1.f);
detail::u5u5u5u1 Unpack;
Unpack.pack = v;
return vec4(Unpack.data.x, Unpack.data.y, Unpack.data.z, Unpack.data.w) * ScaleFactor;
}
GLM_FUNC_QUALIFIER uint8 packUnorm2x3_1x2(vec3 const & v)
{
u32vec3 const Unpack(round(clamp(v, 0.0f, 1.0f) * vec3(7.f, 7.f, 3.f)));
detail::u3u3u2 Result;
Result.data.x = Unpack.x;
Result.data.y = Unpack.y;
Result.data.z = Unpack.z;
return Result.pack;
}
GLM_FUNC_QUALIFIER vec3 unpackUnorm2x3_1x2(uint8 v)
{
vec3 const ScaleFactor(1.f / 7.f, 1.f / 7.f, 1.f / 3.f);
detail::u3u3u2 Unpack;
Unpack.pack = v;
return vec3(Unpack.data.x, Unpack.data.y, Unpack.data.z) * ScaleFactor;
}
}//namespace glm

View File

@ -76,6 +76,26 @@ namespace glm
T x, y, z, w;
# ifdef GLM_STATIC_CONST_MEMBERS
static const type ZERO;
static const type IDENTITY;
static const type X;
static const type Y;
static const type Z;
static const type W;
static const type XY;
static const type XZ;
static const type XW;
static const type YZ;
static const type YW;
static const type ZW;
static const type XYZ;
static const type XYW;
static const type XZW;
static const type YZW;
static const type XYZW;
# endif
// -- Component accesses --
# ifdef GLM_FORCE_SIZE_FUNC
@ -374,6 +394,16 @@ namespace glm
template <typename T, precision P>
GLM_FUNC_DECL tvec4<bool, P> notEqual(tquat<T, P> const & x, tquat<T, P> const & y);
/// @}
// -- Is type --
template <typename T, precision P>
struct type<T, P, tquat>
{
static bool const is_vec = false;
static bool const is_mat = false;
static bool const is_quat = true;
};
} //namespace glm
#include "quaternion.inl"

View File

@ -49,6 +49,73 @@ namespace detail
};
}//namespace detail
# ifdef GLM_STATIC_CONST_MEMBERS
template <typename T, precision P>
const tquat<T, P> tquat<T, P>::ZERO
(static_cast<T>(0), static_cast<T>(0), static_cast<T>(0), static_cast<T>(0));
template <typename T, precision P> const tquat<T, P> tquat<T, P>::IDENTITY;
template <typename T, precision P>
const tquat<T, P> tquat<T, P>::X
(static_cast<T>(0), static_cast<T>(1), static_cast<T>(0), static_cast<T>(0));
template <typename T, precision P>
const tquat<T, P> tquat<T, P>::Y
(static_cast<T>(0), static_cast<T>(0), static_cast<T>(1), static_cast<T>(0));
template <typename T, precision P>
const tquat<T, P> tquat<T, P>::Z
(static_cast<T>(0), static_cast<T>(0), static_cast<T>(0), static_cast<T>(1));
template <typename T, precision P>
const tquat<T, P> tquat<T, P>::W
(static_cast<T>(1), static_cast<T>(0), static_cast<T>(0), static_cast<T>(0));
template <typename T, precision P>
const tquat<T, P> tquat<T, P>::XY
(static_cast<T>(0), static_cast<T>(1), static_cast<T>(1), static_cast<T>(0));
template <typename T, precision P>
const tquat<T, P> tquat<T, P>::XZ
(static_cast<T>(0), static_cast<T>(0), static_cast<T>(1), static_cast<T>(1));
template <typename T, precision P>
const tquat<T, P> tquat<T, P>::XW
(static_cast<T>(1), static_cast<T>(1), static_cast<T>(0), static_cast<T>(0));
template <typename T, precision P>
const tquat<T, P> tquat<T, P>::YZ
(static_cast<T>(0), static_cast<T>(0), static_cast<T>(1), static_cast<T>(1));
template <typename T, precision P>
const tquat<T, P> tquat<T, P>::YW
(static_cast<T>(1), static_cast<T>(0), static_cast<T>(1), static_cast<T>(0));
template <typename T, precision P>
const tquat<T, P> tquat<T, P>::ZW
(static_cast<T>(1), static_cast<T>(0), static_cast<T>(0), static_cast<T>(1));
template <typename T, precision P>
const tquat<T, P> tquat<T, P>::XYZ
(static_cast<T>(0), static_cast<T>(1), static_cast<T>(1), static_cast<T>(1));
template <typename T, precision P>
const tquat<T, P> tquat<T, P>::XYW
(static_cast<T>(1), static_cast<T>(1), static_cast<T>(1), static_cast<T>(0));
template <typename T, precision P>
const tquat<T, P> tquat<T, P>::XZW
(static_cast<T>(1), static_cast<T>(1), static_cast<T>(0), static_cast<T>(1));
template <typename T, precision P>
const tquat<T, P> tquat<T, P>::YZW
(static_cast<T>(1), static_cast<T>(0), static_cast<T>(1), static_cast<T>(1));
template <typename T, precision P>
const tquat<T, P> tquat<T, P>::XYZW
(static_cast<T>(1), static_cast<T>(1), static_cast<T>(1), static_cast<T>(1));
# endif
// -- Component accesses --
# ifdef GLM_FORCE_SIZE_FUNC

View File

@ -60,13 +60,20 @@ namespace glm
///
/// @param Min
/// @param Max
/// @tparam genType Value type. Currently supported: half (not recommanded), float or double scalars and vectors.
/// @tparam genType Value type. Currently supported: float or double scalars.
/// @see gtc_random
template <typename genTYpe>
GLM_FUNC_DECL genTYpe linearRand(
genTYpe Min,
genTYpe Max);
/// Generate random numbers in the interval [Min, Max], according a linear distribution
///
/// @param Min
/// @param Max
/// @tparam T Value type. Currently supported: float or double.
/// @tparam vecType A vertor type: tvec1, tvec2, tvec3, tvec4 or compatible
/// @see gtc_random
template <typename T, precision P, template <typename, precision> class vecType>
GLM_FUNC_DECL vecType<T, P> linearRand(
vecType<T, P> const & Min,

View File

@ -56,77 +56,107 @@ namespace glm
/// Secant function.
/// hypotenuse / adjacent or 1 / cos(x)
///
/// @tparam genType Floating-point scalar or vector types.
///
/// @see gtc_reciprocal
template <typename genType>
GLM_FUNC_DECL genType sec(genType const & angle);
GLM_FUNC_DECL genType sec(genType angle);
/// Cosecant function.
/// hypotenuse / opposite or 1 / sin(x)
///
/// @tparam genType Floating-point scalar or vector types.
///
/// @see gtc_reciprocal
template <typename genType>
GLM_FUNC_DECL genType csc(genType const & angle);
GLM_FUNC_DECL genType csc(genType angle);
/// Cotangent function.
/// adjacent / opposite or 1 / tan(x)
///
/// @tparam genType Floating-point scalar or vector types.
///
/// @see gtc_reciprocal
template <typename genType>
GLM_FUNC_DECL genType cot(genType const & angle);
GLM_FUNC_DECL genType cot(genType angle);
/// Inverse secant function.
///
/// @return Return an angle expressed in radians.
/// @tparam genType Floating-point scalar or vector types.
///
/// @see gtc_reciprocal
template <typename genType>
GLM_FUNC_DECL genType asec(genType const & x);
GLM_FUNC_DECL genType asec(genType x);
/// Inverse cosecant function.
///
/// @return Return an angle expressed in radians.
/// @tparam genType Floating-point scalar or vector types.
///
/// @see gtc_reciprocal
template <typename genType>
GLM_FUNC_DECL genType acsc(genType const & x);
GLM_FUNC_DECL genType acsc(genType x);
/// Inverse cotangent function.
///
/// @return Return an angle expressed in radians.
/// @tparam genType Floating-point scalar or vector types.
///
/// @see gtc_reciprocal
template <typename genType>
GLM_FUNC_DECL genType acot(genType const & x);
GLM_FUNC_DECL genType acot(genType x);
/// Secant hyperbolic function.
///
/// @tparam genType Floating-point scalar or vector types.
///
/// @see gtc_reciprocal
template <typename genType>
GLM_FUNC_DECL genType sech(genType const & angle);
GLM_FUNC_DECL genType sech(genType angle);
/// Cosecant hyperbolic function.
///
/// @tparam genType Floating-point scalar or vector types.
///
/// @see gtc_reciprocal
template <typename genType>
GLM_FUNC_DECL genType csch(genType const & angle);
GLM_FUNC_DECL genType csch(genType angle);
/// Cotangent hyperbolic function.
///
/// @tparam genType Floating-point scalar or vector types.
///
/// @see gtc_reciprocal
template <typename genType>
GLM_FUNC_DECL genType coth(genType const & angle);
GLM_FUNC_DECL genType coth(genType angle);
/// Inverse secant hyperbolic function.
///
/// @return Return an angle expressed in radians.
/// @tparam genType Floating-point scalar or vector types.
///
/// @see gtc_reciprocal
template <typename genType>
GLM_FUNC_DECL genType asech(genType const & x);
GLM_FUNC_DECL genType asech(genType x);
/// Inverse cosecant hyperbolic function.
///
/// @see gtc_reciprocal
template <typename genType>
GLM_FUNC_DECL genType acsch(genType const & x);
/// Inverse cotangent hyperbolic function.
/// @return Return an angle expressed in radians.
/// @tparam genType Floating-point scalar or vector types.
///
/// @see gtc_reciprocal
template <typename genType>
GLM_FUNC_DECL genType acoth(genType const & x);
GLM_FUNC_DECL genType acsch(genType x);
/// Inverse cotangent hyperbolic function.
///
/// @return Return an angle expressed in radians.
/// @tparam genType Floating-point scalar or vector types.
///
/// @see gtc_reciprocal
template <typename genType>
GLM_FUNC_DECL genType acoth(genType x);
/// @}
}//namespace glm

View File

@ -104,10 +104,7 @@ namespace detail
GLM_FUNC_QUALIFIER static genType call(genType Source, genType Multiple)
{
if(Source > genType(0))
{
genType Tmp = Source - genType(1);
return Tmp + (Multiple - std::fmod(Tmp, Multiple));
}
return Source + (Multiple - std::fmod(Source, Multiple));
else
return Source + std::fmod(-Source, Multiple);
}
@ -152,10 +149,7 @@ namespace detail
if(Source >= genType(0))
return Source - std::fmod(Source, Multiple);
else
{
genType Tmp = Source + genType(1);
return Tmp - std::fmod(Tmp, Multiple) - Multiple;
}
return Source - std::fmod(Source, Multiple) - Multiple;
}
};

View File

@ -54,29 +54,37 @@ namespace glm
/// @addtogroup gtx_component_wise
/// @{
/// Convert an integer vector to a normalized float vector.
/// If the parameter value type is already a floating precision type, the value is passed through.
/// @see gtx_component_wise
template <typename floatType, typename T, precision P, template <typename, precision> class vecType>
GLM_FUNC_DECL vecType<floatType, P> compNormalize(vecType<T, P> const & v);
/// Convert a normalized float vector to an integer vector.
/// If the parameter value type is already a floating precision type, the value is passed through.
/// @see gtx_component_wise
template <typename T, typename floatType, precision P, template <typename, precision> class vecType>
GLM_FUNC_DECL vecType<T, P> compScale(vecType<floatType, P> const & v);
/// Add all vector components together.
/// @see gtx_component_wise
template <typename genType>
GLM_FUNC_DECL typename genType::value_type compAdd(
genType const & v);
GLM_FUNC_DECL typename genType::value_type compAdd(genType const & v);
/// Multiply all vector components together.
/// @see gtx_component_wise
template <typename genType>
GLM_FUNC_DECL typename genType::value_type compMul(
genType const & v);
GLM_FUNC_DECL typename genType::value_type compMul(genType const & v);
/// Find the minimum value between single vector components.
/// @see gtx_component_wise
template <typename genType>
GLM_FUNC_DECL typename genType::value_type compMin(
genType const & v);
GLM_FUNC_DECL typename genType::value_type compMin(genType const & v);
/// Find the maximum value between single vector components.
/// @see gtx_component_wise
template <typename genType>
GLM_FUNC_DECL typename genType::value_type compMax(
genType const & v);
GLM_FUNC_DECL typename genType::value_type compMax(genType const & v);
/// @}
}//namespace glm

View File

@ -30,8 +30,95 @@
/// @author Christophe Riccio
///////////////////////////////////////////////////////////////////////////////////////////////////
namespace glm
#include <limits>
namespace glm{
namespace detail
{
template <typename T, typename floatType, precision P, template <typename, precision> class vecType, bool isInteger, bool signedType>
struct compute_compNormalize
{};
template <typename T, typename floatType, precision P, template <typename, precision> class vecType>
struct compute_compNormalize<T, floatType, P, vecType, true, true>
{
GLM_FUNC_QUALIFIER static vecType<floatType, P> call(vecType<T, P> const & v)
{
floatType const Min = static_cast<floatType>(std::numeric_limits<T>::min());
floatType const Max = static_cast<floatType>(std::numeric_limits<T>::max());
return (vecType<floatType, P>(v) - Min) / (Max - Min) * static_cast<floatType>(2) - static_cast<floatType>(1);
}
};
template <typename T, typename floatType, precision P, template <typename, precision> class vecType>
struct compute_compNormalize<T, floatType, P, vecType, true, false>
{
GLM_FUNC_QUALIFIER static vecType<floatType, P> call(vecType<T, P> const & v)
{
return vecType<floatType, P>(v) / static_cast<floatType>(std::numeric_limits<T>::max());
}
};
template <typename T, typename floatType, precision P, template <typename, precision> class vecType>
struct compute_compNormalize<T, floatType, P, vecType, false, true>
{
GLM_FUNC_QUALIFIER static vecType<floatType, P> call(vecType<T, P> const & v)
{
return v;
}
};
template <typename T, typename floatType, precision P, template <typename, precision> class vecType, bool isInteger, bool signedType>
struct compute_compScale
{};
template <typename T, typename floatType, precision P, template <typename, precision> class vecType>
struct compute_compScale<T, floatType, P, vecType, true, true>
{
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<floatType, P> const & v)
{
floatType const Max = static_cast<floatType>(std::numeric_limits<T>::max()) + static_cast<floatType>(0.5);
vecType<floatType, P> const Scaled(v * Max);
vecType<T, P> const Result(Scaled - static_cast<floatType>(0.5));
return Result;
}
};
template <typename T, typename floatType, precision P, template <typename, precision> class vecType>
struct compute_compScale<T, floatType, P, vecType, true, false>
{
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<floatType, P> const & v)
{
return vecType<T, P>(vecType<floatType, P>(v) * static_cast<floatType>(std::numeric_limits<T>::max()));
}
};
template <typename T, typename floatType, precision P, template <typename, precision> class vecType>
struct compute_compScale<T, floatType, P, vecType, false, true>
{
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<floatType, P> const & v)
{
return v;
}
};
}//namespace detail
template <typename floatType, typename T, precision P, template <typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<floatType, P> compNormalize(vecType<T, P> const & v)
{
GLM_STATIC_ASSERT(std::numeric_limits<floatType>::is_iec559, "'compNormalize' accepts only floating-point types for 'floatType' template parameter");
return detail::compute_compNormalize<T, floatType, P, vecType, std::numeric_limits<T>::is_integer, std::numeric_limits<T>::is_signed>::call(v);
}
template <typename T, typename floatType, precision P, template <typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> compScale(vecType<floatType, P> const & v)
{
GLM_STATIC_ASSERT(std::numeric_limits<floatType>::is_iec559, "'compScale' accepts only floating-point types for 'floatType' template parameter");
return detail::compute_compScale<T, floatType, P, vecType, std::numeric_limits<T>::is_integer, std::numeric_limits<T>::is_signed>::call(v);
}
template <typename T, precision P, template <typename, precision> class vecType>
GLM_FUNC_QUALIFIER T compAdd(vecType<T, P> const & v)
{

View File

@ -292,6 +292,16 @@ namespace glm
#endif
/// @}
// -- Is type --
template <typename T, precision P>
struct type<T, P, tdualquat>
{
static bool const is_vec = false;
static bool const is_mat = false;
static bool const is_quat = true;
};
} //namespace glm
#include "dual_quaternion.inl"

View File

@ -24,8 +24,8 @@
/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
/// THE SOFTWARE.
///
/// @ref gtx_extented_min_max
/// @file glm/gtx/extented_min_max.hpp
/// @ref gtx_extended_min_max
/// @file glm/gtx/extended_min_max.hpp
/// @date 2007-03-14 / 2011-06-07
/// @author Christophe Riccio
///
@ -159,4 +159,4 @@ namespace glm
/// @}
}//namespace glm
#include "extented_min_max.inl"
#include "extended_min_max.inl"

View File

@ -24,8 +24,8 @@
/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
/// THE SOFTWARE.
///
/// @ref gtx_extented_min_max
/// @file glm/gtx/extented_min_max.inl
/// @ref gtx_extended_min_max
/// @file glm/gtx/extended_min_max.inl
/// @date 2007-03-14 / 2011-06-07
/// @author Christophe Riccio
///////////////////////////////////////////////////////////////////////////////////////////////////

View File

@ -0,0 +1,43 @@
///////////////////////////////////////////////////////////////////////////////////
/// OpenGL Mathematics (glm.g-truc.net)
///
/// Copyright (c) 2005 - 2015 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.
///
/// Restrictions:
/// By making use of the Software for military purposes, you choose to make
/// a Bunny unhappy.
///
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
/// THE SOFTWARE.
///
/// @ref gtx_float_normalize
/// @file glm/gtx/float_normalize.inl
/// @date 2015-09-25 / 2015-09-25
/// @author Christophe Riccio
///////////////////////////////////////////////////////////////////////////////////
#include <limits>
namespace glm
{
template <typename T, precision P, template <typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<float, P> floatNormalize(vecType<T, P> const & v)
{
return vecType<float, P>(v) / static_cast<float>(std::numeric_limits<T>::max());
}
}//namespace glm

View File

@ -41,10 +41,6 @@
#pragma once
#if !GLM_HAS_CXX11_STL
# error "GLM_GTX_hash requires C++11 standard library support"
#endif
#include <functional>
#include "../vec2.hpp"
@ -67,96 +63,100 @@
#include "../mat4x3.hpp"
#include "../mat4x4.hpp"
#if !GLM_HAS_CXX11_STL
# error "GLM_GTX_hash requires C++11 standard library support"
#endif
namespace std
{
template <typename T, glm::precision P>
struct hash<glm::tvec1<T,P> >
{
GLM_FUNC_DECL size_t operator()(const glm::tvec1<T,P> &v) const;
GLM_FUNC_DECL size_t operator()(glm::tvec1<T, P> const & v) const;
};
template <typename T, glm::precision P>
struct hash<glm::tvec2<T,P> >
{
GLM_FUNC_DECL size_t operator()(const glm::tvec2<T,P> &v) const;
GLM_FUNC_DECL size_t operator()(glm::tvec2<T, P> const & v) const;
};
template <typename T, glm::precision P>
struct hash<glm::tvec3<T,P> >
{
GLM_FUNC_DECL size_t operator()(const glm::tvec3<T,P> &v) const;
GLM_FUNC_DECL size_t operator()(glm::tvec3<T, P> const & v) const;
};
template <typename T, glm::precision P>
struct hash<glm::tvec4<T,P> >
{
GLM_FUNC_DECL size_t operator()(const glm::tvec4<T,P> &v) const;
GLM_FUNC_DECL size_t operator()(glm::tvec4<T, P> const & v) const;
};
template <typename T, glm::precision P>
struct hash<glm::tquat<T,P>>
{
GLM_FUNC_DECL size_t operator()(const glm::tquat<T,P> &q) const;
GLM_FUNC_DECL size_t operator()(glm::tquat<T, P> const & q) const;
};
template <typename T, glm::precision P>
struct hash<glm::tdualquat<T,P> >
{
GLM_FUNC_DECL size_t operator()(const glm::tdualquat<T,P> &q) const;
GLM_FUNC_DECL size_t operator()(glm::tdualquat<T,P> const & q) const;
};
template <typename T, glm::precision P>
struct hash<glm::tmat2x2<T,P> >
{
GLM_FUNC_DECL size_t operator()(const glm::tmat2x2<T,P> &m) const;
GLM_FUNC_DECL size_t operator()(glm::tmat2x2<T,P> const & m) const;
};
template <typename T, glm::precision P>
struct hash<glm::tmat2x3<T,P> >
{
GLM_FUNC_DECL size_t operator()(const glm::tmat2x3<T,P> &m) const;
GLM_FUNC_DECL size_t operator()(glm::tmat2x3<T,P> const & m) const;
};
template <typename T, glm::precision P>
struct hash<glm::tmat2x4<T,P> >
{
GLM_FUNC_DECL size_t operator()(const glm::tmat2x4<T,P> &m) const;
GLM_FUNC_DECL size_t operator()(glm::tmat2x4<T,P> const & m) const;
};
template <typename T, glm::precision P>
struct hash<glm::tmat3x2<T,P> >
{
GLM_FUNC_DECL size_t operator()(const glm::tmat3x2<T,P> &m) const;
GLM_FUNC_DECL size_t operator()(glm::tmat3x2<T,P> const & m) const;
};
template <typename T, glm::precision P>
struct hash<glm::tmat3x3<T,P> >
{
GLM_FUNC_DECL size_t operator()(const glm::tmat3x3<T,P> &m) const;
GLM_FUNC_DECL size_t operator()(glm::tmat3x3<T,P> const & m) const;
};
template <typename T, glm::precision P>
struct hash<glm::tmat3x4<T,P> >
{
GLM_FUNC_DECL size_t operator()(const glm::tmat3x4<T,P> &m) const;
GLM_FUNC_DECL size_t operator()(glm::tmat3x4<T,P> const & m) const;
};
template <typename T, glm::precision P>
struct hash<glm::tmat4x2<T,P> >
{
GLM_FUNC_DECL size_t operator()(const glm::tmat4x2<T,P> &m) const;
GLM_FUNC_DECL size_t operator()(glm::tmat4x2<T,P> const & m) const;
};
template <typename T, glm::precision P>
struct hash<glm::tmat4x3<T,P> >
{
GLM_FUNC_DECL size_t operator()(const glm::tmat4x3<T,P> &m) const;
GLM_FUNC_DECL size_t operator()(glm::tmat4x3<T,P> const & m) const;
};
template <typename T, glm::precision P>
struct hash<glm::tmat4x4<T,P> >
{
GLM_FUNC_DECL size_t operator()(const glm::tmat4x4<T,P> &m) const;
GLM_FUNC_DECL size_t operator()(glm::tmat4x4<T,P> const & m) const;
};
} // namespace std

View File

@ -52,16 +52,14 @@ namespace detail
namespace std
{
template <typename T, glm::precision P>
GLM_FUNC_QUALIFIER size_t
hash<glm::tvec1<T,P>>::operator()(const glm::tvec1<T,P> &v) const
GLM_FUNC_QUALIFIER size_t hash<glm::tvec1<T, P>>::operator()(glm::tvec1<T, P> const & v) const
{
hash<T> hasher;
return hasher(v.x);
}
template <typename T, glm::precision P>
GLM_FUNC_QUALIFIER size_t
hash<glm::tvec2<T,P>>::operator()(const glm::tvec2<T,P> &v) const
GLM_FUNC_QUALIFIER size_t hash<glm::tvec2<T, P>>::operator()(glm::tvec2<T, P> const & v) const
{
size_t seed = 0;
hash<T> hasher;
@ -71,8 +69,7 @@ namespace std
}
template <typename T, glm::precision P>
GLM_FUNC_QUALIFIER size_t
hash<glm::tvec3<T,P>>::operator()(const glm::tvec3<T,P> &v) const
GLM_FUNC_QUALIFIER size_t hash<glm::tvec3<T, P>>::operator()(glm::tvec3<T, P> const & v) const
{
size_t seed = 0;
hash<T> hasher;
@ -83,8 +80,7 @@ namespace std
}
template <typename T, glm::precision P>
GLM_FUNC_QUALIFIER size_t
hash<glm::tvec4<T,P>>::operator()(const glm::tvec4<T,P> &v) const
GLM_FUNC_QUALIFIER size_t hash<glm::tvec4<T, P>>::operator()(glm::tvec4<T, P> const & v) const
{
size_t seed = 0;
hash<T> hasher;
@ -96,8 +92,7 @@ namespace std
}
template <typename T, glm::precision P>
GLM_FUNC_QUALIFIER size_t
hash<glm::tquat<T,P>>::operator()(const glm::tquat<T,P> &q) const
GLM_FUNC_QUALIFIER size_t hash<glm::tquat<T, P>>::operator()(glm::tquat<T,P> const & q) const
{
size_t seed = 0;
hash<T> hasher;
@ -109,8 +104,7 @@ namespace std
}
template <typename T, glm::precision P>
GLM_FUNC_QUALIFIER size_t
hash<glm::tdualquat<T,P>>::operator()(const glm::tdualquat<T,P> &q) const
GLM_FUNC_QUALIFIER size_t hash<glm::tdualquat<T, P>>::operator()(glm::tdualquat<T, P> const & q) const
{
size_t seed = 0;
hash<glm::tquat<T, P>> hasher;
@ -120,8 +114,7 @@ namespace std
}
template <typename T, glm::precision P>
GLM_FUNC_QUALIFIER size_t
hash<glm::tmat2x2<T,P>>::operator()(const glm::tmat2x2<T,P> &m) const
GLM_FUNC_QUALIFIER size_t hash<glm::tmat2x2<T, P>>::operator()(glm::tmat2x2<T, P> const & m) const
{
size_t seed = 0;
hash<glm::tvec2<T, P>> hasher;
@ -131,8 +124,7 @@ namespace std
}
template <typename T, glm::precision P>
GLM_FUNC_QUALIFIER size_t
hash<glm::tmat2x3<T,P>>::operator()(const glm::tmat2x3<T,P> &m) const
GLM_FUNC_QUALIFIER size_t hash<glm::tmat2x3<T, P>>::operator()(glm::tmat2x3<T, P> const & m) const
{
size_t seed = 0;
hash<glm::tvec3<T, P>> hasher;
@ -142,8 +134,7 @@ namespace std
}
template <typename T, glm::precision P>
GLM_FUNC_QUALIFIER size_t
hash<glm::tmat2x4<T,P>>::operator()(const glm::tmat2x4<T,P> &m) const
GLM_FUNC_QUALIFIER size_t hash<glm::tmat2x4<T, P>>::operator()(glm::tmat2x4<T, P> const & m) const
{
size_t seed = 0;
hash<glm::tvec4<T, P>> hasher;
@ -153,8 +144,7 @@ namespace std
}
template <typename T, glm::precision P>
GLM_FUNC_QUALIFIER size_t
hash<glm::tmat3x2<T,P>>::operator()(const glm::tmat3x2<T,P> &m) const
GLM_FUNC_QUALIFIER size_t hash<glm::tmat3x2<T, P>>::operator()(glm::tmat3x2<T, P> const & m) const
{
size_t seed = 0;
hash<glm::tvec2<T, P>> hasher;
@ -165,8 +155,7 @@ namespace std
}
template <typename T, glm::precision P>
GLM_FUNC_QUALIFIER size_t
hash<glm::tmat3x3<T,P>>::operator()(const glm::tmat3x3<T,P> &m) const
GLM_FUNC_QUALIFIER size_t hash<glm::tmat3x3<T, P>>::operator()(glm::tmat3x3<T, P> const & m) const
{
size_t seed = 0;
hash<glm::tvec3<T, P>> hasher;
@ -177,8 +166,7 @@ namespace std
}
template <typename T, glm::precision P>
GLM_FUNC_QUALIFIER size_t
hash<glm::tmat3x4<T,P>>::operator()(const glm::tmat3x4<T,P> &m) const
GLM_FUNC_QUALIFIER size_t hash<glm::tmat3x4<T, P>>::operator()(glm::tmat3x4<T, P> const & m) const
{
size_t seed = 0;
hash<glm::tvec4<T, P>> hasher;
@ -189,8 +177,7 @@ namespace std
}
template <typename T, glm::precision P>
GLM_FUNC_QUALIFIER size_t
hash<glm::tmat4x2<T,P>>::operator()(const glm::tmat4x2<T,P> &m) const
GLM_FUNC_QUALIFIER size_t hash<glm::tmat4x2<T,P>>::operator()(glm::tmat4x2<T,P> const & m) const
{
size_t seed = 0;
hash<glm::tvec2<T, P>> hasher;
@ -202,8 +189,7 @@ namespace std
}
template <typename T, glm::precision P>
GLM_FUNC_QUALIFIER size_t
hash<glm::tmat4x3<T,P>>::operator()(const glm::tmat4x3<T,P> &m) const
GLM_FUNC_QUALIFIER size_t hash<glm::tmat4x3<T,P>>::operator()(glm::tmat4x3<T,P> const & m) const
{
size_t seed = 0;
hash<glm::tvec3<T, P>> hasher;
@ -215,8 +201,7 @@ namespace std
}
template <typename T, glm::precision P>
GLM_FUNC_QUALIFIER size_t
hash<glm::tmat4x4<T,P>>::operator()(const glm::tmat4x4<T,P> &m) const
GLM_FUNC_QUALIFIER size_t hash<glm::tmat4x4<T,P>>::operator()(glm::tmat4x4<T, P> const & m) const
{
size_t seed = 0;
hash<glm::tvec4<T, P>> hasher;

View File

@ -36,7 +36,7 @@
///
/// @brief Decomposes a model matrix to translations, rotation and scale components
///
/// <glm/gtx/decomposition.hpp> need to be included to use these functionalities.
/// <glm/gtx/matrix_decompose.hpp> need to be included to use these functionalities.
///////////////////////////////////////////////////////////////////////////////////
#pragma once

View File

@ -57,7 +57,7 @@ namespace glm
/// @addtogroup gtx_quaternion
/// @{
//! Compute a cross product between a quaternion and a vector.
/// Compute a cross product between a quaternion and a vector.
///
/// @see gtx_quaternion
template<typename T, precision P>

View File

@ -249,6 +249,9 @@ namespace glm
T cosTheta = dot(orig, dest);
tvec3<T, P> rotationAxis;
if(cosTheta >= static_cast<T>(1) - epsilon<T>())
return quat();
if(cosTheta < static_cast<T>(-1) + epsilon<T>())
{
// special case when vectors in opposite directions :

View File

@ -83,6 +83,11 @@ namespace detail
static GLM_RELAXED_CONSTEXPR precision prec = defaultp;
# endif//GLM_META_PROG_HELPERS
# ifdef GLM_STATIC_CONST_MEMBERS
static const type ZERO;
static const type IDENTITY;
# endif
GLM_FUNC_DECL length_t length() const;
fvec4SIMD Data[4];

View File

@ -61,6 +61,11 @@ GLM_FUNC_QUALIFIER fvec4SIMD const & fmat4x4SIMD::operator[]
return this->Data[i];
}
#ifdef GLM_STATIC_CONST_MEMBERS
const fmat4x4SIMD fmat4x4SIMD::ZERO(static_cast<float>(0));
const fmat4x4SIMD fmat4x4SIMD::IDENTITY(static_cast<float>(1));
#endif
//////////////////////////////////////////////////////////////
// Constructors

View File

@ -91,6 +91,26 @@ namespace detail
__m128 Data;
#endif
# ifdef GLM_STATIC_CONST_MEMBERS
static const type ZERO;
static const type IDENTITY;
static const type X;
static const type Y;
static const type Z;
static const type W;
static const type XY;
static const type XZ;
static const type XW;
static const type YZ;
static const type YW;
static const type ZW;
static const type XYZ;
static const type XYW;
static const type XZW;
static const type YZW;
static const type XYZW;
# endif
//////////////////////////////////////
// Implicit basic constructors

View File

@ -51,6 +51,25 @@ void print(const fvec4SIMD &v)
}
#endif
# ifdef GLM_STATIC_CONST_MEMBERS
const fquatSIMD fquatSIMD::ZERO(0, 0, 0, 0);
const fquatSIMD fquatSIMD::IDENTITY(1, 0, 0, 0);
const fquatSIMD fquatSIMD::X(0, 1, 0, 0);
const fquatSIMD fquatSIMD::Y(0, 0, 1, 0);
const fquatSIMD fquatSIMD::Z(0, 0, 0, 1);
const fquatSIMD fquatSIMD::W(1, 0, 0, 0);
const fquatSIMD fquatSIMD::XY(0, 1, 1, 0);
const fquatSIMD fquatSIMD::XZ(0, 1, 0, 1);
const fquatSIMD fquatSIMD::XW(1, 1, 0, 0);
const fquatSIMD fquatSIMD::YZ(0, 0, 1, 1);
const fquatSIMD fquatSIMD::YW(1, 0, 1, 0);
const fquatSIMD fquatSIMD::ZW(1, 0, 0, 1);
const fquatSIMD fquatSIMD::XYZ(0, 1, 1, 1);
const fquatSIMD fquatSIMD::XYW(1, 1, 1, 0);
const fquatSIMD fquatSIMD::XZW(1, 1, 0, 1);
const fquatSIMD fquatSIMD::YZW(1, 0, 1, 1);
const fquatSIMD fquatSIMD::XYZW(1, 1, 1, 1);
# endif
//////////////////////////////////////
// Implicit basic constructors

View File

@ -114,6 +114,25 @@ namespace detail
__m128 Data;
#endif
# ifdef GLM_STATIC_CONST_MEMBERS
static const type ZERO;
static const type X;
static const type Y;
static const type Z;
static const type W;
static const type XY;
static const type XZ;
static const type XW;
static const type YZ;
static const type YW;
static const type ZW;
static const type XYZ;
static const type XYW;
static const type XZW;
static const type YZW;
static const type XYZW;
# endif
//////////////////////////////////////
// Implicit basic constructors
@ -167,15 +186,15 @@ namespace detail
//////////////////////////////////////
// Swizzle operators
template <comp X, comp Y, comp Z, comp W>
template <comp X_, comp Y_, comp Z_, comp W_>
fvec4SIMD& swizzle();
template <comp X, comp Y, comp Z, comp W>
template <comp X_, comp Y_, comp Z_, comp W_>
fvec4SIMD swizzle() const;
template <comp X, comp Y, comp Z>
template <comp X_, comp Y_, comp Z_>
fvec4SIMD swizzle() const;
template <comp X, comp Y>
template <comp X_, comp Y_>
fvec4SIMD swizzle() const;
template <comp X>
template <comp X_>
fvec4SIMD swizzle() const;
};
}//namespace detail

View File

@ -16,6 +16,25 @@ struct shuffle_mask
enum{value = Value};
};
# ifdef GLM_STATIC_CONST_MEMBERS
const fvec4SIMD fvec4SIMD::ZERO(0, 0, 0, 0);
const fvec4SIMD fvec4SIMD::X(1, 0, 0, 0);
const fvec4SIMD fvec4SIMD::Y(0, 1, 0, 0);
const fvec4SIMD fvec4SIMD::Z(0, 0, 1, 0);
const fvec4SIMD fvec4SIMD::W(0, 0, 0, 1);
const fvec4SIMD fvec4SIMD::XY(1, 1, 0, 0);
const fvec4SIMD fvec4SIMD::XZ(1, 0, 1, 0);
const fvec4SIMD fvec4SIMD::XW(1, 0, 0, 1);
const fvec4SIMD fvec4SIMD::YZ(0, 1, 1, 0);
const fvec4SIMD fvec4SIMD::YW(0, 1, 0, 1);
const fvec4SIMD fvec4SIMD::ZW(0, 0, 1, 1);
const fvec4SIMD fvec4SIMD::XYZ(1, 1, 1, 0);
const fvec4SIMD fvec4SIMD::XYW(1, 1, 0, 1);
const fvec4SIMD fvec4SIMD::XZW(1, 0, 1, 1);
const fvec4SIMD fvec4SIMD::YZW(0, 1, 1, 1);
const fvec4SIMD fvec4SIMD::XYZW(1, 1, 1, 1);
# endif
//////////////////////////////////////
// Implicit basic constructors
@ -167,21 +186,21 @@ GLM_FUNC_QUALIFIER fvec4SIMD& fvec4SIMD::operator--()
//////////////////////////////////////
// Swizzle operators
template <comp X, comp Y, comp Z, comp W>
template <comp X_, comp Y_, comp Z_, comp W_>
GLM_FUNC_QUALIFIER fvec4SIMD fvec4SIMD::swizzle() const
{
__m128 Data = _mm_shuffle_ps(
this->Data, this->Data,
shuffle_mask<(W << 6) | (Z << 4) | (Y << 2) | (X << 0)>::value);
shuffle_mask<(W_ << 6) | (Z_ << 4) | (Y_ << 2) | (X_ << 0)>::value);
return fvec4SIMD(Data);
}
template <comp X, comp Y, comp Z, comp W>
template <comp X_, comp Y_, comp Z_, comp W_>
GLM_FUNC_QUALIFIER fvec4SIMD& fvec4SIMD::swizzle()
{
this->Data = _mm_shuffle_ps(
this->Data, this->Data,
shuffle_mask<(W << 6) | (Z << 4) | (Y << 2) | (X << 0)>::value);
shuffle_mask<(W_ << 6) | (Z_ << 4) | (Y_ << 2) | (X_ << 0)>::value);
return *this;
}

View File

@ -48,6 +48,8 @@
// Dependency:
#include "../glm.hpp"
#include "../gtc/type_precision.hpp"
#include "../gtc/quaternion.hpp"
#include "../gtx/dual_quaternion.hpp"
#include <string>
#if(GLM_COMPILER & GLM_COMPILER_CUDA)

View File

@ -444,6 +444,38 @@ namespace detail
x[3][0], x[3][1], x[3][2], x[3][3]);
}
};
template <typename T, precision P>
struct compute_to_string<tquat, T, P>
{
GLM_FUNC_QUALIFIER static std::string call(tquat<T, P> const & x)
{
char const * PrefixStr = prefix<T>::value();
char const * LiteralStr = literal<T, std::numeric_limits<T>::is_iec559>::value();
std::string FormatStr(detail::format("%squat(%s, %s, %s, %s)",
PrefixStr,
LiteralStr, LiteralStr, LiteralStr, LiteralStr));
return detail::format(FormatStr.c_str(), x[0], x[1], x[2], x[3]);
}
};
template <typename T, precision P>
struct compute_to_string<tdualquat, T, P>
{
GLM_FUNC_QUALIFIER static std::string call(tdualquat<T, P> const & x)
{
char const * PrefixStr = prefix<T>::value();
char const * LiteralStr = literal<T, std::numeric_limits<T>::is_iec559>::value();
std::string FormatStr(detail::format("%sdualquat((%s, %s, %s, %s), (%s, %s, %s, %s))",
PrefixStr,
LiteralStr, LiteralStr, LiteralStr, LiteralStr));
return detail::format(FormatStr.c_str(), x.real[0], x.real[1], x.real[2], x.real[3], x.dual[0], x.dual[1], x.dual[2], x.dual[3]);
}
};
}//namespace detail
template <template <typename, precision> class matType, typename T, precision P>

View File

@ -17,7 +17,7 @@ This library works perfectly with *[OpenGL](https://www.opengl.org)* but it also
- [CUDA](https://developer.nvidia.com/about-cuda) 4.0 and higher (experimental)
- Any conform C++98 or C++11 compiler
For more information about *GLM*, please have a look at the [manual](http://glm.g-truc.net/0.9.6/glm-0.9.6.pdf) and the [API reference documentation](http://glm.g-truc.net/0.9.6/api/index.html).
For more information about *GLM*, please have a look at the [manual](http://glm.g-truc.net/0.9.7/glm-0.9.7.pdf) and the [API reference documentation](http://glm.g-truc.net/0.9.7/api/index.html).
The source code and the documentation are licensed under the [Happy Bunny License (Modified MIT) or the MIT License](./copying.txt).
Thanks for contributing to the project by [submitting issues](https://github.com/g-truc/glm/issues) for bug reports and feature requests. Any feedback is welcome at [glm@g-truc.net](mailto://glm@g-truc.net).
@ -28,10 +28,11 @@ Thanks for contributing to the project by [submitting issues](https://github.com
#include <glm/vec4.hpp> // glm::vec4
#include <glm/mat4x4.hpp> // glm::mat4
#include <glm/gtc/matrix_transform.hpp> // glm::translate, glm::rotate, glm::scale, glm::perspective
#include <glm/gtc/constants.hpp> // glm::pi
glm::mat4 camera(float Translate, glm::vec2 const & Rotate)
{
glm::mat4 Projection = glm::perspective(45.0f, 4.0f / 3.0f, 0.1f, 100.f);
glm::mat4 Projection = glm::perspective(glm::pi<float>() * 0.25f, 4.0f / 3.0f, 0.1f, 100.f);
glm::mat4 View = glm::translate(glm::mat4(1.0f), glm::vec3(0.0f, 0.0f, -Translate));
View = glm::rotate(View, Rotate.y, glm::vec3(-1.0f, 0.0f, 0.0f));
View = glm::rotate(View, Rotate.x, glm::vec3(0.0f, 1.0f, 0.0f));
@ -50,6 +51,44 @@ glm::mat4 camera(float Translate, glm::vec2 const & Rotate)
## Release notes
#### [GLM 0.9.8.0](https://github.com/g-truc/glm/releases/latest) - 201X-XX-XX
##### Features:
- Added compNormalize and compScale functions to GTX_component_wise
- Added packF3x9_E1x5 and unpackF3x9_E1x5 to GTC_packing for RGB9E5 #416
- Added (un)packHalf to GTC_packing
- Added (un)packUnorm and (un)packSnorm to GTC_packing
- Added 16bit pack and unpack to GTC_packing
- Added 8bit pack and unpack to GTC_packing
##### Improvements:
- Improved GTC_random linearRand documentation
- Improved GTC_reciprocal documentation
##### Fixes:
- Fixed GTX_extended_min_max filename typo #386
#### [GLM 0.9.7.2](https://github.com/g-truc/glm/tree/0.9.7) - 2015-XX-XX
##### Fixes:
- Fixed GTC_round floorMultiple/ceilMultiple #412
- Fixed GTC_packing unpackUnorm3x10_1x2 #414
- Fixed GTC_matrix_inverse affineInverse #192
#### [GLM 0.9.7.1](https://github.com/g-truc/glm/releases/tag/0.9.7.1) - 2015-09-07
##### Improvements:
- Improved constexpr for constant functions coverage #198
- Added to_string for quat and dual_quat in GTX_string_cast #375
- Improved overall execution time of unit tests #396
##### Fixes:
- Fixed strict alignment warnings #235 #370
- Fixed link errors on compilers not supported default function #377
- Fixed compilation warnings in vec4
- Fixed non-identity quaternions for equal vectors #234
- Fixed excessive GTX_fast_trigonometry execution time #396
- Fixed Visual Studio 2015 'hides class member' warnings #394
- Fixed builtin bitscan never being used #392
- Removed unused func_noise.* files #398
#### [GLM 0.9.7.0](https://github.com/g-truc/glm/releases/tag/0.9.7.0) - 2015-08-02
##### Features:
- Added GTC_color_space: convertLinearToSRGB and convertSRGBToLinear functions

View File

@ -996,11 +996,11 @@ namespace sign
return Error;
}
int perf_rand()
int perf_rand(std::size_t Samples)
{
int Error = 0;
std::size_t const Count = 100000000;
std::size_t const Count = Samples;
std::vector<glm::int32> Input, Output;
Input.resize(Count);
Output.resize(Count);
@ -1049,11 +1049,11 @@ namespace sign
return Error;
}
int perf_linear()
int perf_linear(std::size_t Samples)
{
int Error = 0;
std::size_t const Count = 10000000;
std::size_t const Count = Samples;
std::vector<glm::int32> Input, Output;
Input.resize(Count);
Output.resize(Count);
@ -1096,11 +1096,11 @@ namespace sign
return Error;
}
int perf_linear_cal()
int perf_linear_cal(std::size_t Samples)
{
int Error = 0;
glm::uint32 const Count = 10000000;
glm::int32 const Count = static_cast<glm::int32>(Samples);
std::clock_t Timestamp0 = std::clock();
glm::int32 Sum = 0;
@ -1141,13 +1141,13 @@ namespace sign
return Error;
}
int perf()
int perf(std::size_t Samples)
{
int Error(0);
Error += perf_linear_cal();
Error += perf_linear();
Error += perf_rand();
Error += perf_linear_cal(Samples);
Error += perf_linear(Samples);
Error += perf_rand(Samples);
return Error;
}
@ -1173,7 +1173,8 @@ int main()
Error += isinf_::test();
# ifdef NDEBUG
Error += sign::perf();
std::size_t Samples = 1000;
Error += sign::perf(Samples);
# endif
return Error;

View File

@ -482,11 +482,10 @@ namespace bitfieldReverse
return Error;
}
int perf32()
int perf32(glm::uint32 Count)
{
int Error = 0;
glm::uint32 Count = 10000000;
std::vector<glm::uint32> Data;
Data.resize(static_cast<std::size_t>(Count));
@ -520,11 +519,10 @@ namespace bitfieldReverse
return Error;
}
int perf64()
int perf64(glm::uint64 Count)
{
int Error = 0;
glm::uint64 Count = 10000000;
std::vector<glm::uint64> Data;
Data.resize(static_cast<std::size_t>(Count));
@ -558,12 +556,12 @@ namespace bitfieldReverse
return Error;
}
int perf()
int perf(std::size_t Samples)
{
int Error = 0;
Error += perf32();
Error += perf64();
Error += perf32(Samples);
Error += perf64(Samples);
return Error;
}
@ -671,7 +669,7 @@ namespace findMSB
return 31 - glm::bitCount(~x);
}
int perf_int()
int perf_int(std::size_t Count)
{
type<int, int> const Data[] =
{
@ -713,7 +711,6 @@ namespace findMSB
};
int Error(0);
std::size_t const Count(10000000);
std::clock_t Timestamps0 = std::clock();
@ -949,11 +946,11 @@ namespace findMSB
return Error;
}
int perf()
int perf(std::size_t Samples)
{
int Error(0);
Error += perf_int();
Error += perf_int(Samples);
return Error;
}
@ -1077,10 +1074,9 @@ namespace findLSB
return Error;
}
int perf_int()
int perf_int(std::size_t Count)
{
int Error(0);
std::size_t const Count(10000000);
std::clock_t Timestamps0 = std::clock();
@ -1144,11 +1140,11 @@ namespace findLSB
return Error;
}
int perf()
int perf(std::size_t Samples)
{
int Error(0);
Error += perf_int();
Error += perf_int(Samples);
return Error;
}
@ -1478,11 +1474,10 @@ namespace bitCount
return bitCount_bitfield(glm::tvec1<genType, glm::defaultp>(x)).x;
}
int perf()
int perf(std::size_t Size)
{
int Error(0);
std::size_t Size = 10000000;
std::vector<int> v;
v.resize(Size);
@ -1579,10 +1574,11 @@ int main()
Error += ::bitfieldExtract::test();
# ifdef NDEBUG
Error += ::bitCount::perf();
Error += ::bitfieldReverse::perf();
Error += ::findMSB::perf();
Error += ::findLSB::perf();
std::size_t const Samples = 1000;
::bitCount::perf(Samples);
::bitfieldReverse::perf(Samples);
::findMSB::perf(Samples);
::findLSB::perf(Samples);
# endif
return Error;

View File

@ -304,7 +304,7 @@ int main()
0x40000000,30, 0x80000000,31, 0xFFFFFFF0,4, 0x3000FF00,8,
0xC0000000,30, 0x60000000,29, 0x00011000, 12};
std::size_t const Count = 10000000;
std::size_t const Count = 1000;
n = sizeof(test)/4;

View File

@ -342,7 +342,7 @@ int main()
0x4000000,5, 0x8000000,4, 0x0FFFFFFF,4, 0x10000000,3,
0x3000FFFF,2, 0x50003333,1, 0x7FFFFFFF,1, 0x80000000,0,
0xFFFFFFFF,0};
std::size_t const Count = 10000000;
std::size_t const Count = 1000;
n = sizeof(test)/4;

View File

@ -207,10 +207,8 @@ int test_inverse()
return Failed;
}
std::size_t const Count(10000000);
template <typename VEC3, typename MAT4>
int test_inverse_perf(std::size_t Instance, char const * Message)
int test_inverse_perf(std::size_t Count, std::size_t Instance, char const * Message)
{
std::vector<MAT4> TestInputs;
TestInputs.resize(Count);
@ -264,10 +262,11 @@ int main()
Error += test_inverse();
# ifdef NDEBUG
std::size_t const Samples(1000);
for(std::size_t i = 0; i < 1; ++i)
{
Error += test_inverse_perf<glm::vec3, glm::mat4>(i, "mat4");
Error += test_inverse_perf<glm::dvec3, glm::dmat4>(i, "dmat4");
Error += test_inverse_perf<glm::vec3, glm::mat4>(Samples, i, "mat4");
Error += test_inverse_perf<glm::dvec3, glm::dmat4>(Samples, i, "dmat4");
}
# endif//NDEBUG

View File

@ -29,6 +29,7 @@
/// @author Christophe Riccio
///////////////////////////////////////////////////////////////////////////////////
#define GLM_STATIC_CONST_MEMBERS
#include <glm/gtc/epsilon.hpp>
#include <glm/matrix.hpp>
#include <glm/vector_relational.hpp>
@ -86,6 +87,15 @@ int test_inverse()
return Error;
}
int test_static_const() {
int Error(0);
Error += glm::mat2x2(1) == glm::mat2x2::IDENTITY ? 0 : 1;
Error += glm::mat2x2(0) == glm::mat2x2::ZERO ? 0 : 1;
return Error;
}
int test_ctr()
{
int Error(0);
@ -173,6 +183,7 @@ int main()
#endif
Error += cast::test();
Error += test_static_const();
Error += test_ctr();
Error += test_operators();
Error += test_inverse();

View File

@ -29,6 +29,7 @@
/// @author Christophe Riccio
///////////////////////////////////////////////////////////////////////////////////
#define GLM_STATIC_CONST_MEMBERS
#include <glm/vector_relational.hpp>
#include <glm/mat2x2.hpp>
#include <glm/mat2x3.hpp>
@ -102,6 +103,16 @@ int test_ctr()
return Error;
}
int test_static_const() {
int Error(0);
Error += glm::mat2x3(1) == glm::mat2x3::IDENTITY ? 0 : 1;
Error += glm::mat2x3(0) == glm::mat2x3::ZERO ? 0 : 1;
return Error;
}
namespace cast
{
template <typename genType>
@ -147,6 +158,7 @@ int main()
#endif
Error += cast::test();
Error += test_static_const();
Error += test_ctr();
Error += test_operators();

View File

@ -29,6 +29,7 @@
/// @author Christophe Riccio
///////////////////////////////////////////////////////////////////////////////////
#define GLM_STATIC_CONST_MEMBERS
#include <glm/vector_relational.hpp>
#include <glm/mat2x2.hpp>
#include <glm/mat2x3.hpp>
@ -102,6 +103,15 @@ int test_ctr()
return Error;
}
int test_static_const() {
int Error(0);
Error += glm::mat2x4(1) == glm::mat2x4::IDENTITY ? 0 : 1;
Error += glm::mat2x4(0) == glm::mat2x4::ZERO ? 0 : 1;
return Error;
}
namespace cast
{
template <typename genType>
@ -147,6 +157,7 @@ int main()
#endif
Error += cast::test();
Error += test_static_const();
Error += test_ctr();
Error += test_operators();

View File

@ -29,6 +29,7 @@
/// @author Christophe Riccio
///////////////////////////////////////////////////////////////////////////////////
#define GLM_STATIC_CONST_MEMBERS
#include <glm/vector_relational.hpp>
#include <glm/mat2x2.hpp>
#include <glm/mat2x3.hpp>
@ -106,6 +107,16 @@ int test_ctr()
return Error;
}
int test_static_const() {
int Error(0);
Error += glm::mat3x2(1) == glm::mat3x2::IDENTITY ? 0 : 1;
Error += glm::mat3x2(0) == glm::mat3x2::ZERO ? 0 : 1;
return Error;
}
namespace cast
{
template <typename genType>
@ -152,6 +163,7 @@ int main()
Error += cast::test();
Error += test_ctr();
Error += test_static_const();
Error += test_operators();
return Error;

View File

@ -29,6 +29,7 @@
/// @author Christophe Riccio
///////////////////////////////////////////////////////////////////////////////////
#define GLM_STATIC_CONST_MEMBERS
#include <glm/gtc/epsilon.hpp>
#include <glm/matrix.hpp>
#include <glm/vector_relational.hpp>
@ -165,6 +166,15 @@ int test_ctr()
return Error;
}
int test_static_const() {
int Error(0);
Error += glm::mat3x3(1) == glm::mat3x3::IDENTITY ? 0 : 1;
Error += glm::mat3x3(0) == glm::mat3x3::ZERO ? 0 : 1;
return Error;
}
namespace cast
{
template <typename genType>
@ -210,6 +220,7 @@ int main()
#endif
Error += cast::test();
Error += test_static_const();
Error += test_ctr();
Error += test_mat3x3();
Error += test_operators();

View File

@ -29,6 +29,7 @@
/// @author Christophe Riccio
///////////////////////////////////////////////////////////////////////////////////
#define GLM_STATIC_CONST_MEMBERS
#include <glm/vector_relational.hpp>
#include <glm/mat2x2.hpp>
#include <glm/mat2x3.hpp>
@ -106,6 +107,15 @@ int test_ctr()
return Error;
}
int test_static_const() {
int Error(0);
Error += glm::mat3x4(1) == glm::mat3x4::IDENTITY ? 0 : 1;
Error += glm::mat3x4(0) == glm::mat3x4::ZERO ? 0 : 1;
return Error;
}
namespace cast
{
template <typename genType>
@ -151,6 +161,7 @@ int main()
#endif
Error += cast::test();
Error += test_static_const();
Error += test_ctr();
Error += test_operators();

View File

@ -29,6 +29,7 @@
/// @author Christophe Riccio
///////////////////////////////////////////////////////////////////////////////////
#define GLM_STATIC_CONST_MEMBERS
#include <glm/vector_relational.hpp>
#include <glm/mat2x2.hpp>
#include <glm/mat2x3.hpp>
@ -110,6 +111,15 @@ int test_ctr()
return Error;
}
int test_static_const() {
int Error(0);
Error += glm::mat4x2(1) == glm::mat4x2::IDENTITY ? 0 : 1;
Error += glm::mat4x2(0) == glm::mat4x2::ZERO ? 0 : 1;
return Error;
}
namespace cast
{
template <typename genType>
@ -155,6 +165,7 @@ int main()
#endif
Error += cast::test();
Error += test_static_const();
Error += test_ctr();
Error += test_operators();

View File

@ -29,6 +29,7 @@
/// @author Christophe Riccio
///////////////////////////////////////////////////////////////////////////////////
#define GLM_STATIC_CONST_MEMBERS
#include <glm/vector_relational.hpp>
#include <glm/mat2x2.hpp>
#include <glm/mat2x3.hpp>
@ -110,6 +111,15 @@ int test_ctr()
return Error;
}
int test_static_const() {
int Error(0);
Error += glm::mat4x3(1) == glm::mat4x3::IDENTITY ? 0 : 1;
Error += glm::mat4x3(0) == glm::mat4x3::ZERO ? 0 : 1;
return Error;
}
namespace cast
{
template <typename genType>
@ -155,6 +165,7 @@ int main()
#endif
Error += cast::test();
Error += test_static_const();
Error += test_ctr();
Error += test_operators();

View File

@ -29,6 +29,8 @@
/// @author Christophe Riccio
///////////////////////////////////////////////////////////////////////////////////
#define GLM_STATIC_CONST_MEMBERS
#define GLM_SIMD
#include <glm/gtc/epsilon.hpp>
#include <glm/matrix.hpp>
#include <glm/mat2x2.hpp>
@ -282,6 +284,15 @@ int perf_mul()
return Error;
}
int test_static_const() {
int Error(0);
Error += glm::mat4x4(1) == glm::mat4x4::IDENTITY ? 0 : 1;
Error += glm::mat4x4(0) == glm::mat4x4::ZERO ? 0 : 1;
return Error;
}
namespace cast
{
template <typename genType>
@ -338,6 +349,7 @@ int main()
Error += cast::test();
Error += test_ctr();
Error += test_static_const();
Error += test_inverse_dmat4x4();
Error += test_inverse_mat4x4();
Error += test_operators();

View File

@ -32,6 +32,7 @@
#if !(GLM_COMPILER & GLM_COMPILER_GCC)
# define GLM_META_PROG_HELPERS
#endif
#define GLM_STATIC_CONST_MEMBERS
#define GLM_SWIZZLE
#include <glm/vector_relational.hpp>
#include <glm/gtc/vec1.hpp>
@ -166,6 +167,18 @@ int test_vec1_operator_increment()
return Error;
}
int test_vec1_static_const() {
int Error = 0;
Error += (glm::vec1(1.0f) == glm::vec1::X) ? 0 : 1;
Error += (glm::ivec1(1) == glm::ivec1::X) ? 0 : 1;
Error += (glm::dvec1(1.0) == glm::dvec1::X) ? 0 : 1;
Error += (glm::bvec1(false) == glm::bvec1::ZERO) ? 0 : 1;
Error += (glm::uvec1(0) == glm::uvec1::ZERO) ? 0 : 1;
return Error;
}
int main()
{
int Error = 0;
@ -178,6 +191,7 @@ int main()
assert(glm::vec1::components == 1);
# endif
Error += test_vec1_static_const();
Error += test_vec1_size();
Error += test_vec1_ctor();
Error += test_vec1_operators();

View File

@ -29,6 +29,7 @@
/// @author Christophe Riccio
///////////////////////////////////////////////////////////////////////////////////
#define GLM_STATIC_CONST_MEMBERS
#if !(GLM_COMPILER & GLM_COMPILER_GCC)
# define GLM_META_PROG_HELPERS
#endif
@ -40,6 +41,7 @@
# include <type_traits>
#endif
int test_vec2_operators()
{
int Error = 0;
@ -229,6 +231,12 @@ int test_vec2_ctor()
{
int Error = 0;
{
glm::vec2 A(1);
glm::vec2 B(A);
Error += A == B ? 0 : 1;
}
# if GLM_HAS_TRIVIAL_QUERIES
// Error += std::is_trivially_default_constructible<glm::vec2>::value ? 0 : 1;
// Error += std::is_trivially_copy_assignable<glm::vec2>::value ? 0 : 1;
@ -325,6 +333,17 @@ int test_operator_increment()
return Error;
}
int test_vec2_static_const() {
int Error(0);
Error += (glm::ivec2(0, 0) == glm::ivec2::ZERO) ? 0 : 1;
Error += (glm::vec2(1, 0) == glm::vec2::X) ? 0 : 1;
Error += (glm::bvec2(false, true) == glm::bvec2::Y) ? 0 : 1;
Error += (glm::dvec2(1, 1) == glm::dvec2::XY) ? 0 : 1;
return Error;
}
int main()
{
int Error = 0;
@ -337,6 +356,7 @@ int main()
assert(glm::vec2::components == 2);
# endif
Error += test_vec2_static_const();
Error += test_vec2_size();
Error += test_vec2_ctor();
Error += test_vec2_operators();

View File

@ -33,6 +33,7 @@
# define GLM_META_PROG_HELPERS
#endif
#define GLM_SWIZZLE
#define GLM_STATIC_CONST_MEMBERS
#include <glm/vector_relational.hpp>
#include <glm/geometric.hpp>
#include <glm/vec2.hpp>
@ -493,6 +494,21 @@ int test_operator_increment()
return Error;
}
int test_vec3_static_const() {
int Error(0);
Error += (glm::ivec3(0, 0, 0) == glm::ivec3::ZERO) ? 0 : 1;
Error += (glm::vec3(1, 0, 0) == glm::vec3::X) ? 0 : 1;
Error += (glm::bvec3(false, true, false) == glm::bvec3::Y) ? 0 : 1;
Error += (glm::bvec3(false, false, true) == glm::bvec3::Z) ? 0 : 1;
Error += (glm::dvec3(1, 1, 0) == glm::dvec3::XY) ? 0 : 1;
Error += (glm::vec3(1, 0, 1) == glm::vec3::XZ) ? 0 : 1;
Error += (glm::uvec3(0u, 1u, 1u) == glm::uvec3::YZ) ? 0 : 1;
Error += (glm::dvec3(1, 1, 1) == glm::dvec3::XYZ) ? 0 : 1;
return Error;
}
int main()
{
int Error = 0;
@ -505,6 +521,7 @@ int main()
assert(glm::vec3::components == 3);
# endif
Error += test_vec3_static_const();
Error += test_vec3_ctor();
Error += test_vec3_operators();
Error += test_vec3_size();

View File

@ -33,6 +33,7 @@
# define GLM_META_PROG_HELPERS
#endif
#define GLM_SWIZZLE
#define GLM_STATIC_CONST_MEMBERS
#include <glm/vector_relational.hpp>
#include <glm/vec2.hpp>
#include <glm/vec3.hpp>
@ -376,6 +377,28 @@ int test_operator_increment()
return Error;
}
int test_vec4_static_const() {
int Error(0);
Error += (glm::ivec4(0, 0, 0, 0) == glm::ivec4::ZERO) ? 0 : 1;
Error += (glm::vec4(1, 0, 0, 0) == glm::vec4::X) ? 0 : 1;
Error += (glm::bvec4(false, true, false, false) == glm::bvec4::Y) ? 0 : 1;
Error += (glm::bvec4(false, false, true, false) == glm::bvec4::Z) ? 0 : 1;
Error += (glm::uvec4(0u, 0u, 0u, 1u) == glm::uvec4::W) ? 0 : 1;
Error += (glm::dvec4(1, 1, 0, 0) == glm::dvec4::XY) ? 0 : 1;
Error += (glm::vec4(1, 0, 1, 0) == glm::vec4::XZ) ? 0 : 1;
Error += (glm::vec4(1, 0, 0, 1) == glm::vec4::XW) ? 0 : 1;
Error += (glm::uvec4(0u, 1u, 1u, 0u) == glm::uvec4::YZ) ? 0 : 1;
Error += (glm::vec4(0, 1, 0, 1) == glm::vec4::YW) ? 0 : 1;
Error += (glm::dvec4(1, 1, 1, 0) == glm::dvec4::XYZ) ? 0 : 1;
Error += (glm::vec4(1, 1, 0, 1) == glm::vec4::XYW) ? 0 : 1;
Error += (glm::vec4(1, 0, 1, 1) == glm::vec4::XZW) ? 0 : 1;
Error += (glm::vec4(0, 1, 1, 1) == glm::vec4::YZW) ? 0 : 1;
Error += (glm::vec4(1, 1, 1, 1) == glm::vec4::XYZW) ? 0 : 1;
return Error;
}
struct AoS
{
glm::vec4 A;
@ -486,6 +509,7 @@ int main()
Error += test_vec4_perf_SoA(Size);
# endif//NDEBUG
Error += test_vec4_static_const();
Error += test_vec4_ctor();
Error += test_vec4_size();
Error += test_vec4_operators();

View File

@ -83,10 +83,9 @@ namespace log2_
return Error;
}
int perf()
int perf(std::size_t Count)
{
int Error = 0;
std::size_t const Count(100000000);
{
std::vector<int> Result;
@ -218,7 +217,8 @@ int main()
Error += ::log2_::test();
# ifdef NDEBUG
Error += ::log2_::perf();
std::size_t const Samples(1000);
Error += ::log2_::perf(Samples);
# endif//NDEBUG
return Error;

View File

@ -30,10 +30,53 @@
///////////////////////////////////////////////////////////////////////////////////
#include <glm/gtc/matrix_inverse.hpp>
#include <glm/gtc/epsilon.hpp>
int test_affine()
{
int Error = 0;
{
glm::mat3 const M(
2.f, 0.f, 0.f,
0.f, 2.f, 0.f,
0.f, 0.f, 1.f);
glm::mat3 const A = glm::affineInverse(M);
glm::mat3 const I = glm::inverse(M);
glm::mat3 const R = glm::affineInverse(A);
for(glm::length_t i = 0; i < A.length(); ++i)
{
Error += glm::all(glm::epsilonEqual(M[i], R[i], 0.01f)) ? 0 : 1;
Error += glm::all(glm::epsilonEqual(A[i], I[i], 0.01f)) ? 0 : 1;
}
}
{
glm::mat4 const M(
2.f, 0.f, 0.f, 0.f,
0.f, 2.f, 0.f, 0.f,
0.f, 0.f, 2.f, 0.f,
0.f, 0.f, 0.f, 1.f);
glm::mat4 const A = glm::affineInverse(M);
glm::mat4 const I = glm::inverse(M);
glm::mat4 const R = glm::affineInverse(A);
for(glm::length_t i = 0; i < A.length(); ++i)
{
Error += glm::all(glm::epsilonEqual(M[i], R[i], 0.01f)) ? 0 : 1;
Error += glm::all(glm::epsilonEqual(A[i], I[i], 0.01f)) ? 0 : 1;
}
}
return Error;
}
int main()
{
int Error = 0;
Error += test_affine();
return Error;
}

View File

@ -128,7 +128,11 @@ int test_Half4x16()
glm::vec4 v0 = glm::unpackHalf4x16(p0);
glm::uint64 p1 = glm::packHalf4x16(v0);
glm::vec4 v1 = glm::unpackHalf4x16(p1);
glm::u16vec4 p2 = glm::packHalf(v0);
glm::vec4 v2 = glm::unpackHalf(p2);
Error += glm::all(glm::equal(v0, v1)) ? 0 : 1;
Error += glm::all(glm::equal(v0, v2)) ? 0 : 1;
}
return Error;
@ -220,10 +224,10 @@ int test_Unorm3x10_1x2()
for(std::size_t i = 0; i < Tests.size(); ++i)
{
glm::uint32 p0 = glm::packSnorm3x10_1x2(Tests[i]);
glm::vec4 v0 = glm::unpackSnorm3x10_1x2(p0);
glm::uint32 p1 = glm::packSnorm3x10_1x2(v0);
glm::vec4 v1 = glm::unpackSnorm3x10_1x2(p1);
glm::uint32 p0 = glm::packUnorm3x10_1x2(Tests[i]);
glm::vec4 v0 = glm::unpackUnorm3x10_1x2(p0);
glm::uint32 p1 = glm::packUnorm3x10_1x2(v0);
glm::vec4 v1 = glm::unpackUnorm3x10_1x2(p1);
Error += glm::all(glm::equal(v0, v1)) ? 0 : 1;
}
@ -254,6 +258,30 @@ int test_F2x11_1x10()
return Error;
}
int test_F3x9_E1x5()
{
int Error = 0;
std::vector<glm::vec3> Tests;
Tests.push_back(glm::vec3(1.0f));
Tests.push_back(glm::vec3(0.0f));
Tests.push_back(glm::vec3(2.0f));
Tests.push_back(glm::vec3(0.1f));
Tests.push_back(glm::vec3(0.5f));
Tests.push_back(glm::vec3(0.9f));
for (std::size_t i = 0; i < Tests.size(); ++i)
{
glm::uint32 p0 = glm::packF3x9_E1x5(Tests[i]);
glm::vec3 v0 = glm::unpackF3x9_E1x5(p0);
glm::uint32 p1 = glm::packF3x9_E1x5(v0);
glm::vec3 v1 = glm::unpackF3x9_E1x5(p1);
Error += glm::all(glm::epsilonEqual(v0, v1, 0.01f)) ? 0 : 1;
}
return Error;
}
int test_packUnorm1x16()
{
int Error = 0;
@ -394,7 +422,7 @@ int test_packUnorm1x8()
for(std::size_t i = 0; i < A.size(); ++i)
{
glm::vec1 B(A[i]);
glm::uint16 C = glm::packUnorm1x8(B.x);
glm::uint8 C = glm::packUnorm1x8(B.x);
glm::vec1 D(glm::unpackUnorm1x8(C));
Error += glm::all(glm::epsilonEqual(B, D, 1.0f / 255.f)) ? 0 : 1;
assert(!Error);
@ -414,7 +442,7 @@ int test_packSnorm1x8()
for(std::size_t i = 0; i < A.size(); ++i)
{
glm::vec1 B(A[i]);
glm::uint16 C = glm::packSnorm1x8(B.x);
glm::uint8 C = glm::packSnorm1x8(B.x);
glm::vec1 D(glm::unpackSnorm1x8(C));
Error += glm::all(glm::epsilonEqual(B, D, 1.0f / 127.f)) ? 0 : 1;
}
@ -501,9 +529,153 @@ int test_packSnorm4x8()
return Error;
}
int test_packUnorm()
{
int Error = 0;
std::vector<glm::vec2> A;
A.push_back(glm::vec2(1.0f, 0.7f));
A.push_back(glm::vec2(0.5f, 0.1f));
for(std::size_t i = 0; i < A.size(); ++i)
{
glm::vec2 B(A[i]);
glm::u16vec2 C = glm::packUnorm<glm::uint16>(B);
glm::vec2 D = glm::unpackUnorm<glm::uint16, float>(C);
Error += glm::all(glm::epsilonEqual(B, D, 1.0f / 255.f)) ? 0 : 1;
assert(!Error);
}
return Error;
}
int test_packSnorm()
{
int Error = 0;
std::vector<glm::vec2> A;
A.push_back(glm::vec2( 1.0f, 0.0f));
A.push_back(glm::vec2(-0.5f,-0.7f));
A.push_back(glm::vec2(-0.1f, 0.1f));
for(std::size_t i = 0; i < A.size(); ++i)
{
glm::vec2 B(A[i]);
glm::i16vec2 C = glm::packSnorm<glm::int16>(B);
glm::vec2 D = glm::unpackSnorm<glm::int16, float>(C);
Error += glm::all(glm::epsilonEqual(B, D, 1.0f / 32767.0f * 2.0f)) ? 0 : 1;
assert(!Error);
}
return Error;
}
int test_packUnorm2x4()
{
int Error = 0;
std::vector<glm::vec2> A;
A.push_back(glm::vec2(1.0f, 0.7f));
A.push_back(glm::vec2(0.5f, 0.0f));
for(std::size_t i = 0; i < A.size(); ++i)
{
glm::vec2 B(A[i]);
glm::uint8 C = glm::packUnorm2x4(B);
glm::vec2 D = glm::unpackUnorm2x4(C);
Error += glm::all(glm::epsilonEqual(B, D, 1.0f / 15.f)) ? 0 : 1;
assert(!Error);
}
return Error;
}
int test_packUnorm4x4()
{
int Error = 0;
std::vector<glm::vec4> A;
A.push_back(glm::vec4(1.0f, 0.7f, 0.5f, 0.0f));
A.push_back(glm::vec4(0.5f, 0.1f, 0.0f, 1.0f));
for(std::size_t i = 0; i < A.size(); ++i)
{
glm::vec4 B(A[i]);
glm::uint16 C = glm::packUnorm4x4(B);
glm::vec4 D = glm::unpackUnorm4x4(C);
Error += glm::all(glm::epsilonEqual(B, D, 1.0f / 15.f)) ? 0 : 1;
assert(!Error);
}
return Error;
}
int test_packUnorm3x5_1x1()
{
int Error = 0;
std::vector<glm::vec4> A;
A.push_back(glm::vec4(1.0f, 0.7f, 0.5f, 0.0f));
A.push_back(glm::vec4(0.5f, 0.1f, 0.0f, 1.0f));
for(std::size_t i = 0; i < A.size(); ++i)
{
glm::vec4 B(A[i]);
glm::uint16 C = glm::packUnorm3x5_1x1(B);
glm::vec4 D = glm::unpackUnorm3x5_1x1(C);
Error += glm::all(glm::epsilonEqual(B, D, 1.0f / 15.f)) ? 0 : 1;
assert(!Error);
}
return Error;
}
int test_packUnorm1x5_1x6_1x5()
{
int Error = 0;
std::vector<glm::vec3> A;
A.push_back(glm::vec3(1.0f, 0.7f, 0.5f));
A.push_back(glm::vec3(0.5f, 0.1f, 0.0f));
for(std::size_t i = 0; i < A.size(); ++i)
{
glm::vec3 B(A[i]);
glm::uint16 C = glm::packUnorm1x5_1x6_1x5(B);
glm::vec3 D = glm::unpackUnorm1x5_1x6_1x5(C);
Error += glm::all(glm::epsilonEqual(B, D, 1.0f / 15.f)) ? 0 : 1;
assert(!Error);
}
return Error;
}
int test_packUnorm2x3_1x2()
{
int Error = 0;
std::vector<glm::vec3> A;
A.push_back(glm::vec3(1.0f, 0.7f, 0.5f));
A.push_back(glm::vec3(0.5f, 0.1f, 0.0f));
for(std::size_t i = 0; i < A.size(); ++i)
{
glm::vec3 B(A[i]);
glm::uint8 C = glm::packUnorm2x3_1x2(B);
glm::vec3 D = glm::unpackUnorm2x3_1x2(C);
Error += glm::all(glm::epsilonEqual(B, D, 1.0f / 3.f)) ? 0 : 1;
assert(!Error);
}
return Error;
}
int main()
{
int Error(0);
int Error = 0;
Error += test_packUnorm();
Error += test_packSnorm();
Error += test_packSnorm1x16();
Error += test_packSnorm2x16();
@ -521,13 +693,20 @@ int main()
Error += test_packUnorm2x8();
Error += test_packUnorm4x8();
Error += test_packUnorm2x4();
Error += test_packUnorm4x4();
Error += test_packUnorm3x5_1x1();
Error += test_packUnorm1x5_1x6_1x5();
Error += test_packUnorm2x3_1x2();
Error += test_F2x11_1x10();
Error += test_F3x9_E1x5();
Error += test_Snorm3x10_1x2();
Error += test_Unorm3x10_1x2();
Error += test_I3x10_1x2();
Error += test_U3x10_1x2();
Error += test_Half1x16();
Error += test_U3x10_1x2();
Error += test_Half4x16();
return Error;
}

View File

@ -31,6 +31,7 @@
#include <glm/gtc/round.hpp>
#include <glm/gtc/type_precision.hpp>
#include <glm/gtc/vec1.hpp>
#include <glm/gtc/epsilon.hpp>
#include <vector>
#include <ctime>
#include <cstdio>
@ -293,6 +294,86 @@ namespace ceilPowerOfTwo
}
}//namespace ceilPowerOfTwo
namespace floorMultiple
{
template <typename genType>
struct type
{
genType Source;
genType Multiple;
genType Return;
genType Epsilon;
};
int test_float()
{
type<glm::float64> const Data[] =
{
{3.4, 0.3, 3.3, 0.0001},
{-1.4, 0.3, -1.5, 0.0001},
};
int Error(0);
for(std::size_t i = 0, n = sizeof(Data) / sizeof(type<glm::float64>); i < n; ++i)
{
glm::float64 Result = glm::floorMultiple(Data[i].Source, Data[i].Multiple);
Error += glm::epsilonEqual(Data[i].Return, Result, Data[i].Epsilon) ? 0 : 1;
}
return Error;
}
int test()
{
int Error(0);
Error += test_float();
return Error;
}
}//namespace floorMultiple
namespace ceilMultiple
{
template <typename genType>
struct type
{
genType Source;
genType Multiple;
genType Return;
genType Epsilon;
};
int test_float()
{
type<glm::float64> const Data[] =
{
{3.4, 0.3, 3.6, 0.0001},
{-1.4, 0.3, -1.2, 0.0001},
};
int Error(0);
for(std::size_t i = 0, n = sizeof(Data) / sizeof(type<glm::float64>); i < n; ++i)
{
glm::float64 Result = glm::ceilMultiple(Data[i].Source, Data[i].Multiple);
Error += glm::epsilonEqual(Data[i].Return, Result, Data[i].Epsilon) ? 0 : 1;
}
return Error;
}
int test()
{
int Error(0);
Error += test_float();
return Error;
}
}//namespace ceilMultiple
int main()
{
int Error(0);
@ -304,5 +385,8 @@ int main()
Error += ceilPowerOfTwo::perf();
# endif//NDEBUG
Error += floorMultiple::test();
Error += ceilMultiple::test();
return Error;
}

View File

@ -7,7 +7,7 @@ glmCreateTestGTC(gtx_compatibility)
glmCreateTestGTC(gtx_component_wise)
glmCreateTestGTC(gtx_euler_angle)
glmCreateTestGTC(gtx_extend)
glmCreateTestGTC(gtx_extented_min_max)
glmCreateTestGTC(gtx_extended_min_max)
glmCreateTestGTC(gtx_fast_exponential)
glmCreateTestGTC(gtx_fast_square_root)
glmCreateTestGTC(gtx_fast_trigonometry)

View File

@ -40,7 +40,7 @@ namespace fmod_
template <typename genType>
GLM_FUNC_QUALIFIER genType modTrunc(genType a, genType b)
{
return a - b * trunc(a / b);
return a - b * glm::trunc(a / b);
}
int test()

View File

@ -25,15 +25,122 @@
/// THE SOFTWARE.
///
/// @file test/gtx/gtx_component_wise.cpp
/// @date 2013-10-25 / 2014-11-25
/// @date 2013-10-25 / 2015-09-25
/// @author Christophe Riccio
///////////////////////////////////////////////////////////////////////////////////
#include <glm/gtx/component_wise.hpp>
#include <glm/gtc/type_precision.hpp>
#include <glm/gtc/epsilon.hpp>
#include <glm/gtc/constants.hpp>
#include <limits>
namespace compNormalize
{
int run()
{
int Error(0);
{
glm::vec4 const A = glm::compNormalize<float>(glm::u8vec4(0, 127, 128, 255));
Error += glm::epsilonEqual(A.x, 0.0f, glm::epsilon<float>()) ? 0 : 1;
Error += A.y < 0.5f ? 0 : 1;
Error += A.z > 0.5f ? 0 : 1;
Error += glm::epsilonEqual(A.w, 1.0f, glm::epsilon<float>()) ? 0 : 1;
}
{
glm::vec4 const A = glm::compNormalize<float>(glm::i8vec4(-128, -1, 0, 127));
Error += glm::epsilonEqual(A.x,-1.0f, glm::epsilon<float>()) ? 0 : 1;
Error += A.y < 0.0f ? 0 : 1;
Error += A.z > 0.0f ? 0 : 1;
Error += glm::epsilonEqual(A.w, 1.0f, glm::epsilon<float>()) ? 0 : 1;
}
{
glm::vec4 const A = glm::compNormalize<float>(glm::u16vec4(
std::numeric_limits<glm::u16>::min(),
(std::numeric_limits<glm::u16>::max() >> 1) + 0,
(std::numeric_limits<glm::u16>::max() >> 1) + 1,
std::numeric_limits<glm::u16>::max()));
Error += glm::epsilonEqual(A.x, 0.0f, glm::epsilon<float>()) ? 0 : 1;
Error += A.y < 0.5f ? 0 : 1;
Error += A.z > 0.5f ? 0 : 1;
Error += glm::epsilonEqual(A.w, 1.0f, glm::epsilon<float>()) ? 0 : 1;
}
{
glm::vec4 const A = glm::compNormalize<float>(glm::i16vec4(
std::numeric_limits<glm::i16>::min(),
static_cast<glm::i16>(-1),
static_cast<glm::i16>(0),
std::numeric_limits<glm::i16>::max()));
Error += glm::epsilonEqual(A.x,-1.0f, glm::epsilon<float>()) ? 0 : 1;
Error += A.y < 0.0f ? 0 : 1;
Error += A.z > 0.0f ? 0 : 1;
Error += glm::epsilonEqual(A.w, 1.0f, glm::epsilon<float>()) ? 0 : 1;
}
return Error;
}
}//namespace compNormalize
namespace compScale
{
int run()
{
int Error(0);
{
glm::u8vec4 const A = glm::compScale<glm::u8>(glm::vec4(0.0f, 0.2f, 0.5f, 1.0f));
Error += A.x == std::numeric_limits<glm::u8>::min() ? 0 : 1;
Error += A.y < (std::numeric_limits<glm::u8>::max() >> 2) ? 0 : 1;
Error += A.z == 127 ? 0 : 1;
Error += A.w == 255 ? 0 : 1;
}
{
glm::i8vec4 const A = glm::compScale<glm::i8>(glm::vec4(0.0f,-1.0f, 0.5f, 1.0f));
Error += A.x == 0 ? 0 : 1;
Error += A.y == -128 ? 0 : 1;
Error += A.z == 63 ? 0 : 1;
Error += A.w == 127 ? 0 : 1;
}
{
glm::u16vec4 const A = glm::compScale<glm::u16>(glm::vec4(0.0f, 0.2f, 0.5f, 1.0f));
Error += A.x == std::numeric_limits<glm::u16>::min() ? 0 : 1;
Error += A.y < (std::numeric_limits<glm::u16>::max() >> 2) ? 0 : 1;
Error += A.z == 32767 ? 0 : 1;
Error += A.w == 65535 ? 0 : 1;
}
{
glm::i16vec4 const A = glm::compScale<glm::i16>(glm::vec4(0.0f,-1.0f, 0.5f, 1.0f));
Error += A.x == 0 ? 0 : 1;
Error += A.y == -32768 ? 0 : 1;
Error += A.z == 16383 ? 0 : 1;
Error += A.w == 32767 ? 0 : 1;
}
return Error;
}
}// compScale
int main()
{
int Error(0);
Error += compNormalize::run();
Error += compScale::run();
return Error;
}

View File

@ -0,0 +1,39 @@
///////////////////////////////////////////////////////////////////////////////////
/// OpenGL Mathematics (glm.g-truc.net)
///
/// Copyright (c) 2005 - 2015 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.
///
/// Restrictions:
/// By making use of the Software for military purposes, you choose to make
/// a Bunny unhappy.
///
/// 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.
///
/// @file test/gtx/gtx_extented_min_max.cpp
/// @date 2013-10-25 / 2014-11-25
/// @author Christophe Riccio
///////////////////////////////////////////////////////////////////////////////////
#include <glm/gtx/extended_min_max.hpp>
int main()
{
int Error(0);
return Error;
}

View File

@ -29,7 +29,7 @@
/// @author Christophe Riccio
///////////////////////////////////////////////////////////////////////////////////
#include <glm/gtx/extented_min_max.hpp>
#include <glm/gtx/extended_min_max.hpp>
int main()
{

View File

@ -44,18 +44,18 @@
namespace fastCos
{
int perf()
int perf(bool NextFloat)
{
const float begin = -glm::pi<float>();
const float end = glm::pi<float>();
float result = 0.f;
const std::clock_t timestamp1 = std::clock();
for(float i = begin; i < end; i = glm::next_float(i))
for(float i = begin; i < end; i = NextFloat ? glm::next_float(i) : i += 0.1f)
result = glm::fastCos(i);
const std::clock_t timestamp2 = std::clock();
for(float i = begin; i < end; i = glm::next_float(i))
for(float i = begin; i < end; i = NextFloat ? glm::next_float(i) : i += 0.1f)
result = glm::cos(i);
const std::clock_t timestamp3 = std::clock();
@ -64,7 +64,7 @@ namespace fastCos
std::printf("fastCos Time %d clocks\n", static_cast<unsigned int>(time_fast));
std::printf("cos Time %d clocks\n", static_cast<unsigned int>(time_default));
return time_fast < time_default ? 0 : 1;
return time_fast <= time_default ? 0 : 1;
}
}//namespace fastCos
@ -78,18 +78,18 @@ namespace fastSin
}
*/
int perf()
int perf(bool NextFloat)
{
const float begin = -glm::pi<float>();
const float end = glm::pi<float>();
float result = 0.f;
const std::clock_t timestamp1 = std::clock();
for(float i = begin; i < end; i = glm::next_float(i))
for(float i = begin; i < end; i = NextFloat ? glm::next_float(i) : i += 0.1f)
result = glm::fastSin(i);
const std::clock_t timestamp2 = std::clock();
for(float i = begin; i < end; i = glm::next_float(i))
for(float i = begin; i < end; i = NextFloat ? glm::next_float(i) : i += 0.1f)
result = glm::sin(i);
const std::clock_t timestamp3 = std::clock();
@ -98,24 +98,24 @@ namespace fastSin
std::printf("fastSin Time %d clocks\n", static_cast<unsigned int>(time_fast));
std::printf("sin Time %d clocks\n", static_cast<unsigned int>(time_default));
return time_fast < time_default ? 0 : 1;
return time_fast <= time_default ? 0 : 1;
}
}//namespace fastSin
namespace fastTan
{
int perf()
int perf(bool NextFloat)
{
const float begin = -glm::pi<float>();
const float end = glm::pi<float>();
float result = 0.f;
const std::clock_t timestamp1 = std::clock();
for(float i = begin; i < end; i = glm::next_float(i))
for(float i = begin; i < end; i = NextFloat ? glm::next_float(i) : i += 0.1f)
result = glm::fastTan(i);
const std::clock_t timestamp2 = std::clock();
for (float i = begin; i < end; i = glm::next_float(i))
for (float i = begin; i < end; i = NextFloat ? glm::next_float(i) : i += 0.1f)
result = glm::tan(i);
const std::clock_t timestamp3 = std::clock();
@ -124,24 +124,24 @@ namespace fastTan
std::printf("fastTan Time %d clocks\n", static_cast<unsigned int>(time_fast));
std::printf("tan Time %d clocks\n", static_cast<unsigned int>(time_default));
return time_fast < time_default ? 0 : 1;
return time_fast <= time_default ? 0 : 1;
}
}//namespace fastTan
namespace fastAcos
{
int perf()
int perf(bool NextFloat)
{
const float begin = -glm::pi<float>();
const float end = glm::pi<float>();
float result = 0.f;
const std::clock_t timestamp1 = std::clock();
for(float i = begin; i < end; i = glm::next_float(i))
for(float i = begin; i < end; i = NextFloat ? glm::next_float(i) : i += 0.1f)
result = glm::fastAcos(i);
const std::clock_t timestamp2 = std::clock();
for(float i = begin; i < end; i = glm::next_float(i))
for(float i = begin; i < end; i = NextFloat ? glm::next_float(i) : i += 0.1f)
result = glm::acos(i);
const std::clock_t timestamp3 = std::clock();
@ -151,22 +151,22 @@ namespace fastAcos
std::printf("fastAcos Time %d clocks\n", static_cast<unsigned int>(time_fast));
std::printf("acos Time %d clocks\n", static_cast<unsigned int>(time_default));
return time_fast < time_default ? 0 : 1;
return time_fast <= time_default ? 0 : 1;
}
}//namespace fastAcos
namespace fastAsin
{
int perf()
int perf(bool NextFloat)
{
const float begin = -glm::pi<float>();
const float end = glm::pi<float>();
float result = 0.f;
const std::clock_t timestamp1 = std::clock();
for(float i = begin; i < end; i = glm::next_float(i))
for(float i = begin; i < end; i = NextFloat ? glm::next_float(i) : i += 0.1f)
result = glm::fastAsin(i);
const std::clock_t timestamp2 = std::clock();
for(float i = begin; i < end; i = glm::next_float(i))
for(float i = begin; i < end; i = NextFloat ? glm::next_float(i) : i += 0.1f)
result = glm::asin(i);
const std::clock_t timestamp3 = std::clock();
const std::clock_t time_fast = timestamp2 - timestamp1;
@ -174,22 +174,22 @@ namespace fastAsin
std::printf("fastAsin Time %d clocks\n", static_cast<unsigned int>(time_fast));
std::printf("asin Time %d clocks\n", static_cast<unsigned int>(time_default));
return time_fast < time_default ? 0 : 1;
return time_fast <= time_default ? 0 : 1;
}
}//namespace fastAsin
namespace fastAtan
{
int perf()
int perf(bool NextFloat)
{
const float begin = -glm::pi<float>();
const float end = glm::pi<float>();
float result = 0.f;
const std::clock_t timestamp1 = std::clock();
for(float i = begin; i < end; i = glm::next_float(i))
for(float i = begin; i < end; i = NextFloat ? glm::next_float(i) : i += 0.1f)
result = glm::fastAtan(i);
const std::clock_t timestamp2 = std::clock();
for(float i = begin; i < end; i = glm::next_float(i))
for(float i = begin; i < end; i = NextFloat ? glm::next_float(i) : i += 0.1f)
result = glm::atan(i);
const std::clock_t timestamp3 = std::clock();
const std::clock_t time_fast = timestamp2 - timestamp1;
@ -197,7 +197,7 @@ namespace fastAtan
std::printf("fastAtan Time %d clocks\n", static_cast<unsigned int>(time_fast));
std::printf("atan Time %d clocks\n", static_cast<unsigned int>(time_default));
return time_fast < time_default ? 0 : 1;
return time_fast <= time_default ? 0 : 1;
}
}//namespace fastAtan
@ -414,13 +414,12 @@ namespace taylorCos
return Error;
}
int perf()
int perf(std::size_t const Samples)
{
int Error = 0;
float const Begin = -glm::pi<float>();
float const End = glm::pi<float>();
std::size_t const Samples = 10000000;
Error += perf_cos(Begin, End, Samples);
Error += perf_fastCosOld(Begin, End, Samples);
@ -462,15 +461,15 @@ int main()
int Error(0);
Error += ::taylorCos::test();
Error += ::taylorCos::perf();
Error += ::taylorCos::perf(1000);
# ifdef NDEBUG
Error += ::fastCos::perf();
Error += ::fastSin::perf();
Error += ::fastTan::perf();
Error += ::fastAcos::perf();
Error += ::fastAsin::perf();
Error += ::fastAtan::perf();
::fastCos::perf(false);
::fastSin::perf(false);
::fastTan::perf(false);
::fastAcos::perf(false);
::fastAsin::perf(false);
::fastAtan::perf(false);
# endif//NDEBUG
return Error;

View File

@ -29,6 +29,7 @@
/// @author Christophe Riccio
///////////////////////////////////////////////////////////////////////////////////
#define GLM_STATIC_CONST_MEMBERS
#include <glm/glm.hpp>
#include <glm/gtc/matrix_transform.hpp>
#include <glm/gtc/quaternion.hpp>
@ -252,6 +253,15 @@ int test_compute_gtx()
return 0;
}
int test_static_const() {
int Error(0);
Error += glm::mat4_cast(glm::simdMat4(static_cast<float>(1))) == glm::mat4_cast(glm::simdMat4::IDENTITY) ? 0 : 1;
Error += glm::mat4_cast(glm::simdMat4(static_cast<float>(0))) == glm::mat4_cast(glm::simdMat4::ZERO) ? 0 : 1;
return Error;
}
int main()
{
int Error = 0;
@ -313,7 +323,7 @@ int main()
Error += test_compute_glm();
Error += test_compute_gtx();
Error += test_static_const();
float Det = glm::determinant(glm::simdMat4(1.0));
Error += Det == 1.0f ? 0 : 1;

View File

@ -29,6 +29,8 @@
/// @author Christophe Riccio
///////////////////////////////////////////////////////////////////////////////////
#define GLM_STATIC_CONST_MEMBERS
#include <glm/glm.hpp>
#include <glm/gtx/simd_vec4.hpp>
#include <cstdio>

Some files were not shown because too many files have changed in this diff Show More