mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-11 21:01:29 +00:00
Updated version of glm
This commit is contained in:
parent
a71690b725
commit
03286f540a
@ -325,7 +325,7 @@ IF(EQEMU_BUILD_LUA)
|
||||
ENDIF(EQEMU_SANITIZE_LUA_LIBS)
|
||||
ENDIF(EQEMU_BUILD_LUA)
|
||||
|
||||
INCLUDE_DIRECTORIES(SYSTEM "${ZLIB_INCLUDE_DIRS}" "${MySQL_INCLUDE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/common/glm/glm")
|
||||
INCLUDE_DIRECTORIES(SYSTEM "${ZLIB_INCLUDE_DIRS}" "${MySQL_INCLUDE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/common/glm")
|
||||
|
||||
IF(EQEMU_BUILD_LUA)
|
||||
ADD_SUBDIRECTORY(luabind)
|
||||
|
||||
@ -30,11 +30,13 @@ source_group("GTX Files" FILES ${GTX_HEADER})
|
||||
|
||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/..)
|
||||
|
||||
add_executable(${NAME} ${ROOT_TEXT}
|
||||
${ROOT_SOURCE} ${ROOT_INLINE} ${ROOT_HEADER}
|
||||
${CORE_SOURCE} ${CORE_INLINE} ${CORE_HEADER}
|
||||
${GTC_SOURCE} ${GTC_INLINE} ${GTC_HEADER}
|
||||
${GTX_SOURCE} ${GTX_INLINE} ${GTX_HEADER})
|
||||
if(GLM_TEST_ENABLE)
|
||||
add_executable(${NAME} ${ROOT_TEXT}
|
||||
${ROOT_SOURCE} ${ROOT_INLINE} ${ROOT_HEADER}
|
||||
${CORE_SOURCE} ${CORE_INLINE} ${CORE_HEADER}
|
||||
${GTC_SOURCE} ${GTC_INLINE} ${GTC_HEADER}
|
||||
${GTX_SOURCE} ${GTX_INLINE} ${GTX_HEADER})
|
||||
endif(GLM_TEST_ENABLE)
|
||||
|
||||
#add_library(glm STATIC glm.cpp)
|
||||
#add_library(glm_shared SHARED glm.cpp)
|
||||
|
||||
@ -12,6 +12,10 @@
|
||||
/// 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
|
||||
@ -26,9 +30,6 @@
|
||||
/// @author Christophe Riccio
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef GLM_COMMON_INCLUDED
|
||||
#define GLM_COMMON_INCLUDED
|
||||
#pragma once
|
||||
|
||||
#include "detail/func_common.hpp"
|
||||
|
||||
#endif//GLM_COMMON_INCLUDED
|
||||
|
||||
@ -12,6 +12,10 @@
|
||||
/// 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
|
||||
@ -21,13 +25,12 @@
|
||||
/// THE SOFTWARE.
|
||||
///
|
||||
/// @ref core
|
||||
/// @file glm/core/_features.hpp
|
||||
/// @file glm/detail/_features.hpp
|
||||
/// @date 2013-02-20 / 2013-02-20
|
||||
/// @author Christophe Riccio
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef glm_core_features
|
||||
#define glm_core_features
|
||||
#pragma once
|
||||
|
||||
// #define GLM_CXX98_EXCEPTIONS
|
||||
// #define GLM_CXX98_RTTI
|
||||
@ -281,7 +284,7 @@
|
||||
# define GLM_CXX11_STATIC_ASSERT
|
||||
# endif
|
||||
|
||||
#elif(GLM_COMPILER & GLM_COMPILER_CLANG)
|
||||
#elif(GLM_COMPILER & (GLM_COMPILER_APPLE_CLANG | GLM_COMPILER_LLVM))
|
||||
# if(__has_feature(cxx_exceptions))
|
||||
# define GLM_CXX98_EXCEPTIONS
|
||||
# endif
|
||||
@ -422,6 +425,4 @@
|
||||
# define GLM_CXX11_VARIADIC_TEMPLATES
|
||||
# endif
|
||||
|
||||
#endif//(GLM_COMPILER & GLM_COMPILER_CLANG)
|
||||
|
||||
#endif//glm_core_features
|
||||
#endif//(GLM_COMPILER & (GLM_COMPILER_APPLE_CLANG | GLM_COMPILER_LLVM))
|
||||
|
||||
@ -12,6 +12,10 @@
|
||||
/// 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
|
||||
@ -21,7 +25,7 @@
|
||||
/// THE SOFTWARE.
|
||||
///
|
||||
/// @ref core
|
||||
/// @file glm/core/_fixes.hpp
|
||||
/// @file glm/detail/_fixes.hpp
|
||||
/// @date 2011-02-21 / 2011-11-22
|
||||
/// @author Christophe Riccio
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@ -12,6 +12,10 @@
|
||||
/// 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
|
||||
@ -26,8 +30,12 @@
|
||||
/// @author Christophe Riccio
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef GLM_DETAIL_NOISE_INCLUDED
|
||||
#define GLM_DETAIL_NOISE_INCLUDED
|
||||
#pragma once
|
||||
|
||||
#include "../vec2.hpp"
|
||||
#include "../vec3.hpp"
|
||||
#include "../vec4.hpp"
|
||||
#include "../common.hpp"
|
||||
|
||||
namespace glm{
|
||||
namespace detail
|
||||
@ -75,19 +83,19 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER detail::tvec2<T, P> taylorInvSqrt(detail::tvec2<T, P> const & r)
|
||||
GLM_FUNC_QUALIFIER tvec2<T, P> taylorInvSqrt(tvec2<T, P> const & r)
|
||||
{
|
||||
return T(1.79284291400159) - T(0.85373472095314) * r;
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER detail::tvec3<T, P> taylorInvSqrt(detail::tvec3<T, P> const & r)
|
||||
GLM_FUNC_QUALIFIER tvec3<T, P> taylorInvSqrt(tvec3<T, P> const & r)
|
||||
{
|
||||
return T(1.79284291400159) - T(0.85373472095314) * r;
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER detail::tvec4<T, P> taylorInvSqrt(detail::tvec4<T, P> const & r)
|
||||
GLM_FUNC_QUALIFIER tvec4<T, P> taylorInvSqrt(tvec4<T, P> const & r)
|
||||
{
|
||||
return T(1.79284291400159) - T(0.85373472095314) * r;
|
||||
}
|
||||
@ -100,19 +108,19 @@ namespace detail
|
||||
*/
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER detail::tvec2<T, P> fade(detail::tvec2<T, P> const & t)
|
||||
GLM_FUNC_QUALIFIER tvec2<T, P> fade(tvec2<T, P> const & t)
|
||||
{
|
||||
return (t * t * t) * (t * (t * T(6) - T(15)) + T(10));
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER detail::tvec3<T, P> fade(detail::tvec3<T, P> const & t)
|
||||
GLM_FUNC_QUALIFIER tvec3<T, P> fade(tvec3<T, P> const & t)
|
||||
{
|
||||
return (t * t * t) * (t * (t * T(6) - T(15)) + T(10));
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER detail::tvec4<T, P> fade(detail::tvec4<T, P> const & t)
|
||||
GLM_FUNC_QUALIFIER tvec4<T, P> fade(tvec4<T, P> const & t)
|
||||
{
|
||||
return (t * t * t) * (t * (t * T(6) - T(15)) + T(10));
|
||||
}
|
||||
@ -126,5 +134,3 @@ namespace detail
|
||||
}//namespace detail
|
||||
}//namespace glm
|
||||
|
||||
#endif//GLM_DETAIL_NOISE_INCLUDED
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -12,6 +12,10 @@
|
||||
/// 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
|
||||
@ -21,13 +25,12 @@
|
||||
/// THE SOFTWARE.
|
||||
///
|
||||
/// @ref core
|
||||
/// @file glm/core/_swizzle_func.hpp
|
||||
/// @file glm/detail/_swizzle_func.hpp
|
||||
/// @date 2011-10-16 / 2011-10-16
|
||||
/// @author Christophe Riccio
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef glm_core_swizzle_func
|
||||
#define glm_core_swizzle_func
|
||||
#pragma once
|
||||
|
||||
#define GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, CONST, A, B) \
|
||||
SWIZZLED_TYPE<TMPL_TYPE, PRECISION> A ## B() CONST \
|
||||
@ -720,5 +723,3 @@
|
||||
GLM_SWIZZLE_GEN_VEC_FROM_VEC4_COMP(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, SWIZZLED_VEC4_TYPE, s, t, p, q)
|
||||
|
||||
//GLM_SWIZZLE_GEN_VEC_FROM_VEC4(valType, detail::vec4, detail::vec2, detail::vec3, detail::vec4)
|
||||
|
||||
#endif//glm_core_swizzle_func
|
||||
|
||||
@ -12,6 +12,10 @@
|
||||
/// 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
|
||||
@ -21,197 +25,136 @@
|
||||
/// THE SOFTWARE.
|
||||
///
|
||||
/// @ref core
|
||||
/// @file glm/core/_vectorize.hpp
|
||||
/// @file glm/detail/_vectorize.hpp
|
||||
/// @date 2011-10-14 / 2011-10-14
|
||||
/// @author Christophe Riccio
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef GLM_CORE_DETAIL_INCLUDED
|
||||
#define GLM_CORE_DETAIL_INCLUDED
|
||||
#pragma once
|
||||
|
||||
#include "type_vec1.hpp"
|
||||
#include "type_vec2.hpp"
|
||||
#include "type_vec3.hpp"
|
||||
#include "type_vec4.hpp"
|
||||
|
||||
#define VECTORIZE1_VEC(func) \
|
||||
template <typename T, precision P> \
|
||||
GLM_FUNC_QUALIFIER detail::tvec1<T, P> func( \
|
||||
detail::tvec1<T, P> const & v) \
|
||||
{ \
|
||||
return detail::tvec1<T, P>( \
|
||||
func(v.x)); \
|
||||
}
|
||||
|
||||
#define VECTORIZE2_VEC(func) \
|
||||
template <typename T, precision P> \
|
||||
GLM_FUNC_QUALIFIER detail::tvec2<T, P> func( \
|
||||
detail::tvec2<T, P> const & v) \
|
||||
{ \
|
||||
return detail::tvec2<T, P>( \
|
||||
func(v.x), \
|
||||
func(v.y)); \
|
||||
}
|
||||
|
||||
#define VECTORIZE3_VEC(func) \
|
||||
template <typename T, precision P> \
|
||||
GLM_FUNC_QUALIFIER detail::tvec3<T, P> func( \
|
||||
detail::tvec3<T, P> const & v) \
|
||||
{ \
|
||||
return detail::tvec3<T, P>( \
|
||||
func(v.x), \
|
||||
func(v.y), \
|
||||
func(v.z)); \
|
||||
}
|
||||
|
||||
#define VECTORIZE4_VEC(func) \
|
||||
template <typename T, precision P> \
|
||||
GLM_FUNC_QUALIFIER detail::tvec4<T, P> func( \
|
||||
detail::tvec4<T, P> const & v) \
|
||||
{ \
|
||||
return detail::tvec4<T, P>( \
|
||||
func(v.x), \
|
||||
func(v.y), \
|
||||
func(v.z), \
|
||||
func(v.w)); \
|
||||
}
|
||||
|
||||
#define VECTORIZE_VEC(func) \
|
||||
VECTORIZE1_VEC(func) \
|
||||
VECTORIZE2_VEC(func) \
|
||||
VECTORIZE3_VEC(func) \
|
||||
VECTORIZE4_VEC(func)
|
||||
|
||||
#define VECTORIZE1_VEC_SCA(func) \
|
||||
template <typename T, precision P> \
|
||||
GLM_FUNC_QUALIFIER detail::tvec1<T, P> func \
|
||||
( \
|
||||
detail::tvec1<T, P> const & x, \
|
||||
T const & y \
|
||||
) \
|
||||
{ \
|
||||
return detail::tvec1<T, P>( \
|
||||
func(x.x, y)); \
|
||||
}
|
||||
|
||||
#define VECTORIZE2_VEC_SCA(func) \
|
||||
template <typename T, precision P> \
|
||||
GLM_FUNC_QUALIFIER detail::tvec2<T, P> func \
|
||||
( \
|
||||
detail::tvec2<T, P> const & x, \
|
||||
T const & y \
|
||||
) \
|
||||
{ \
|
||||
return detail::tvec2<T, P>( \
|
||||
func(x.x, y), \
|
||||
func(x.y, y)); \
|
||||
}
|
||||
|
||||
#define VECTORIZE3_VEC_SCA(func) \
|
||||
template <typename T, precision P> \
|
||||
GLM_FUNC_QUALIFIER detail::tvec3<T, P> func \
|
||||
( \
|
||||
detail::tvec3<T, P> const & x, \
|
||||
T const & y \
|
||||
) \
|
||||
{ \
|
||||
return detail::tvec3<T, P>( \
|
||||
func(x.x, y), \
|
||||
func(x.y, y), \
|
||||
func(x.z, y)); \
|
||||
}
|
||||
|
||||
#define VECTORIZE4_VEC_SCA(func) \
|
||||
template <typename T, precision P> \
|
||||
GLM_FUNC_QUALIFIER detail::tvec4<T, P> func \
|
||||
( \
|
||||
detail::tvec4<T, P> const & x, \
|
||||
T const & y \
|
||||
) \
|
||||
{ \
|
||||
return detail::tvec4<T, P>( \
|
||||
func(x.x, y), \
|
||||
func(x.y, y), \
|
||||
func(x.z, y), \
|
||||
func(x.w, y)); \
|
||||
}
|
||||
|
||||
#define VECTORIZE_VEC_SCA(func) \
|
||||
VECTORIZE1_VEC_SCA(func) \
|
||||
VECTORIZE2_VEC_SCA(func) \
|
||||
VECTORIZE3_VEC_SCA(func) \
|
||||
VECTORIZE4_VEC_SCA(func)
|
||||
|
||||
#define VECTORIZE2_VEC_VEC(func) \
|
||||
template <typename T, precision P> \
|
||||
GLM_FUNC_QUALIFIER detail::tvec2<T, P> func \
|
||||
( \
|
||||
detail::tvec2<T, P> const & x, \
|
||||
detail::tvec2<T, P> const & y \
|
||||
) \
|
||||
{ \
|
||||
return detail::tvec2<T, P>( \
|
||||
func(x.x, y.x), \
|
||||
func(x.y, y.y)); \
|
||||
}
|
||||
|
||||
#define VECTORIZE3_VEC_VEC(func) \
|
||||
template <typename T, precision P> \
|
||||
GLM_FUNC_QUALIFIER detail::tvec3<T, P> func \
|
||||
( \
|
||||
detail::tvec3<T, P> const & x, \
|
||||
detail::tvec3<T, P> const & y \
|
||||
) \
|
||||
{ \
|
||||
return detail::tvec3<T, P>( \
|
||||
func(x.x, y.x), \
|
||||
func(x.y, y.y), \
|
||||
func(x.z, y.z)); \
|
||||
}
|
||||
|
||||
#define VECTORIZE4_VEC_VEC(func) \
|
||||
template <typename T, precision P> \
|
||||
GLM_FUNC_QUALIFIER detail::tvec4<T, P> func \
|
||||
( \
|
||||
detail::tvec4<T, P> const & x, \
|
||||
detail::tvec4<T, P> const & y \
|
||||
) \
|
||||
{ \
|
||||
return detail::tvec4<T, P>( \
|
||||
func(x.x, y.x), \
|
||||
func(x.y, y.y), \
|
||||
func(x.z, y.z), \
|
||||
func(x.w, y.w)); \
|
||||
}
|
||||
|
||||
#define VECTORIZE_VEC_VEC(func) \
|
||||
VECTORIZE2_VEC_VEC(func) \
|
||||
VECTORIZE3_VEC_VEC(func) \
|
||||
VECTORIZE4_VEC_VEC(func)
|
||||
|
||||
namespace glm{
|
||||
namespace detail
|
||||
{
|
||||
template<bool C>
|
||||
struct If
|
||||
template <typename R, typename T, precision P, template <typename, precision> class vecType>
|
||||
struct functor1{};
|
||||
|
||||
template <typename R, typename T, precision P>
|
||||
struct functor1<R, T, P, tvec1>
|
||||
{
|
||||
template<typename F, typename T>
|
||||
static GLM_FUNC_QUALIFIER T apply(F functor, const T& val)
|
||||
GLM_FUNC_QUALIFIER static tvec1<R, P> call(R (*Func) (T x), tvec1<T, P> const & v)
|
||||
{
|
||||
return functor(val);
|
||||
return tvec1<R, P>(Func(v.x));
|
||||
}
|
||||
};
|
||||
|
||||
template<>
|
||||
struct If<false>
|
||||
template <typename R, typename T, precision P>
|
||||
struct functor1<R, T, P, tvec2>
|
||||
{
|
||||
template<typename F, typename T>
|
||||
static GLM_FUNC_QUALIFIER T apply(F, const T& val)
|
||||
GLM_FUNC_QUALIFIER static tvec2<R, P> call(R (*Func) (T x), tvec2<T, P> const & v)
|
||||
{
|
||||
return val;
|
||||
return tvec2<R, P>(Func(v.x), Func(v.y));
|
||||
}
|
||||
};
|
||||
|
||||
template <typename R, typename T, precision P>
|
||||
struct functor1<R, T, P, tvec3>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static tvec3<R, P> call(R (*Func) (T x), tvec3<T, P> const & v)
|
||||
{
|
||||
return tvec3<R, P>(Func(v.x), Func(v.y), Func(v.z));
|
||||
}
|
||||
};
|
||||
|
||||
template <typename R, typename T, precision P>
|
||||
struct functor1<R, T, P, tvec4>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static tvec4<R, P> call(R (*Func) (T x), tvec4<T, P> const & v)
|
||||
{
|
||||
return tvec4<R, P>(Func(v.x), Func(v.y), Func(v.z), Func(v.w));
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
struct functor2{};
|
||||
|
||||
template <typename T, precision P>
|
||||
struct functor2<T, P, tvec1>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static tvec1<T, P> call(T (*Func) (T x, T y), tvec1<T, P> const & a, tvec1<T, P> const & b)
|
||||
{
|
||||
return tvec1<T, P>(Func(a.x, b.x));
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T, precision P>
|
||||
struct functor2<T, P, tvec2>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static tvec2<T, P> call(T (*Func) (T x, T y), tvec2<T, P> const & a, tvec2<T, P> const & b)
|
||||
{
|
||||
return tvec2<T, P>(Func(a.x, b.x), Func(a.y, b.y));
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T, precision P>
|
||||
struct functor2<T, P, tvec3>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static tvec3<T, P> call(T (*Func) (T x, T y), tvec3<T, P> const & a, tvec3<T, P> const & b)
|
||||
{
|
||||
return tvec3<T, P>(Func(a.x, b.x), Func(a.y, b.y), Func(a.z, b.z));
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T, precision P>
|
||||
struct functor2<T, P, tvec4>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static tvec4<T, P> call(T (*Func) (T x, T y), tvec4<T, P> const & a, tvec4<T, P> const & b)
|
||||
{
|
||||
return tvec4<T, P>(Func(a.x, b.x), Func(a.y, b.y), Func(a.z, b.z), Func(a.w, b.w));
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
struct functor2_vec_sca{};
|
||||
|
||||
template <typename T, precision P>
|
||||
struct functor2_vec_sca<T, P, tvec1>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static tvec1<T, P> call(T (*Func) (T x, T y), tvec1<T, P> const & a, T b)
|
||||
{
|
||||
return tvec1<T, P>(Func(a.x, b));
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T, precision P>
|
||||
struct functor2_vec_sca<T, P, tvec2>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static tvec2<T, P> call(T (*Func) (T x, T y), tvec2<T, P> const & a, T b)
|
||||
{
|
||||
return tvec2<T, P>(Func(a.x, b), Func(a.y, b));
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T, precision P>
|
||||
struct functor2_vec_sca<T, P, tvec3>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static tvec3<T, P> call(T (*Func) (T x, T y), tvec3<T, P> const & a, T b)
|
||||
{
|
||||
return tvec3<T, P>(Func(a.x, b), Func(a.y, b), Func(a.z, b));
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T, precision P>
|
||||
struct functor2_vec_sca<T, P, tvec4>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static tvec4<T, P> call(T (*Func) (T x, T y), tvec4<T, P> const & a, T b)
|
||||
{
|
||||
return tvec4<T, P>(Func(a.x, b), Func(a.y, b), Func(a.z, b), Func(a.w, b));
|
||||
}
|
||||
};
|
||||
}//namespace detail
|
||||
}//namespace glm
|
||||
|
||||
#endif//GLM_CORE_DETAIL_INCLUDED
|
||||
|
||||
@ -12,6 +12,10 @@
|
||||
/// 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
|
||||
@ -29,7 +33,6 @@
|
||||
/// dummy.cpp exist only a wordaround for CMake file.
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define GLM_FORCE_RADIANS
|
||||
#define GLM_MESSAGES
|
||||
#include "../glm.hpp"
|
||||
#include <limits>
|
||||
@ -42,6 +45,7 @@ struct material
|
||||
glm::vec4 specular; // Scm
|
||||
float shininess; // Srm
|
||||
};
|
||||
|
||||
struct light
|
||||
{
|
||||
glm::vec4 ambient; // Acli
|
||||
@ -60,6 +64,7 @@ struct light
|
||||
float quadraticAttenuation;// K2
|
||||
};
|
||||
|
||||
|
||||
// Sample 1
|
||||
#include <glm/vec3.hpp>// glm::vec3
|
||||
#include <glm/geometric.hpp>// glm::cross, glm::normalize
|
||||
@ -184,7 +189,34 @@ glm::vec3 lighting
|
||||
return Color;
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
template <typename T, glm::precision P, template<typename, glm::precision> class vecType>
|
||||
T normalizeDotA(vecType<T, P> const & x, vecType<T, P> const & y)
|
||||
{
|
||||
return glm::dot(x, y) * glm::inversesqrt(glm::dot(x, x) * glm::dot(y, y));
|
||||
}
|
||||
|
||||
#define GLM_TEMPLATE_GENTYPE typename T, glm::precision P, template<typename, glm::precision> class
|
||||
|
||||
template <GLM_TEMPLATE_GENTYPE vecType>
|
||||
T normalizeDotB(vecType<T, P> const & x, vecType<T, P> const & y)
|
||||
{
|
||||
return glm::dot(x, y) * glm::inversesqrt(glm::dot(x, x) * glm::dot(y, y));
|
||||
}
|
||||
|
||||
template <typename vecType>
|
||||
typename vecType::value_type normalizeDotC(vecType const & a, vecType const & b)
|
||||
{
|
||||
return glm::dot(a, b) * glm::inversesqrt(glm::dot(a, a) * glm::dot(b, b));
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
glm::vec4 v(1);
|
||||
float a = normalizeDotA(v, v);
|
||||
float b = normalizeDotB(v, v);
|
||||
float c = normalizeDotC(v, v);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -12,6 +12,10 @@
|
||||
/// 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
|
||||
@ -21,7 +25,7 @@
|
||||
/// THE SOFTWARE.
|
||||
///
|
||||
/// @ref core
|
||||
/// @file glm/core/func_common.hpp
|
||||
/// @file glm/detail/func_common.hpp
|
||||
/// @date 2008-03-08 / 2010-01-26
|
||||
/// @author Christophe Riccio
|
||||
///
|
||||
@ -33,8 +37,7 @@
|
||||
/// These all operate component-wise. The description is per component.
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef GLM_FUNC_COMMON_INCLUDED
|
||||
#define GLM_FUNC_COMMON_INCLUDED
|
||||
#pragma once
|
||||
|
||||
#include "setup.hpp"
|
||||
#include "precision.hpp"
|
||||
@ -53,7 +56,10 @@ namespace glm
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/abs.xml">GLSL abs man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
|
||||
template <typename genType>
|
||||
GLM_FUNC_DECL genType abs(genType const & x);
|
||||
GLM_FUNC_DECL genType abs(genType x);
|
||||
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<T, P> abs(vecType<T, P> const & x);
|
||||
|
||||
/// Returns 1.0 if x > 0, 0.0 if x == 0, or -1.0 if x < 0.
|
||||
///
|
||||
@ -61,17 +67,17 @@ namespace glm
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/sign.xml">GLSL sign man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
|
||||
template <typename genType>
|
||||
GLM_FUNC_DECL genType sign(genType const & x);
|
||||
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<T, P> sign(vecType<T, P> const & x);
|
||||
|
||||
/// Returns a value equal to the nearest integer that is less then or equal to x.
|
||||
///
|
||||
/// @tparam genType Floating-point scalar or vector types.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/floor.xml">GLSL floor man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
|
||||
template <typename genType>
|
||||
GLM_FUNC_DECL genType floor(genType const & x);
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<T, P> floor(vecType<T, P> const & x);
|
||||
|
||||
/// Returns a value equal to the nearest integer to x
|
||||
/// whose absolute value is not larger than the absolute value of x.
|
||||
@ -80,8 +86,8 @@ namespace glm
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/trunc.xml">GLSL trunc man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
|
||||
template <typename genType>
|
||||
GLM_FUNC_DECL genType trunc(genType const & x);
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<T, P> trunc(vecType<T, P> const & x);
|
||||
|
||||
/// Returns a value equal to the nearest integer to x.
|
||||
/// The fraction 0.5 will round in a direction chosen by the
|
||||
@ -93,9 +99,9 @@ namespace glm
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/round.xml">GLSL round man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
|
||||
template <typename genType>
|
||||
GLM_FUNC_DECL genType round(genType const & x);
|
||||
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<T, P> round(vecType<T, P> const & x);
|
||||
|
||||
/// Returns a value equal to the nearest integer to x.
|
||||
/// A fractional part of 0.5 will round toward the nearest even
|
||||
/// integer. (Both 3.5 and 4.5 for x will return 4.0.)
|
||||
@ -105,8 +111,8 @@ namespace glm
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/roundEven.xml">GLSL roundEven man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
|
||||
/// @see <a href="http://developer.amd.com/documentation/articles/pages/New-Round-to-Even-Technique.aspx">New round to even technique</a>
|
||||
template <typename genType>
|
||||
GLM_FUNC_DECL genType roundEven(genType const & x);
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<T, P> roundEven(vecType<T, P> const & x);
|
||||
|
||||
/// Returns a value equal to the nearest integer
|
||||
/// that is greater than or equal to x.
|
||||
@ -115,8 +121,8 @@ namespace glm
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/ceil.xml">GLSL ceil man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
|
||||
template <typename genType>
|
||||
GLM_FUNC_DECL genType ceil(genType const & x);
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<T, P> ceil(vecType<T, P> const & x);
|
||||
|
||||
/// Return x - floor(x).
|
||||
///
|
||||
@ -125,7 +131,10 @@ namespace glm
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/fract.xml">GLSL fract man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
|
||||
template <typename genType>
|
||||
GLM_FUNC_DECL genType fract(genType const & x);
|
||||
GLM_FUNC_DECL genType fract(genType x);
|
||||
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<T, P> fract(vecType<T, P> const & x);
|
||||
|
||||
/// Modulus. Returns x - y * floor(x / y)
|
||||
/// for each component in x using the floating point value y.
|
||||
@ -135,21 +144,13 @@ namespace glm
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/mod.xml">GLSL mod man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
|
||||
template <typename genType>
|
||||
GLM_FUNC_DECL genType mod(
|
||||
genType const & x,
|
||||
genType const & y);
|
||||
GLM_FUNC_DECL genType mod(genType x, genType y);
|
||||
|
||||
/// Modulus. Returns x - y * floor(x / y)
|
||||
/// for each component in x using the floating point value y.
|
||||
///
|
||||
/// @tparam genType Floating-point scalar or vector types.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/mod.xml">GLSL mod man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
|
||||
template <typename genType>
|
||||
GLM_FUNC_DECL genType mod(
|
||||
genType const & x,
|
||||
typename genType::value_type const & y);
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<T, P> mod(vecType<T, P> const & x, T y);
|
||||
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<T, P> mod(vecType<T, P> const & x, vecType<T, P> const & y);
|
||||
|
||||
/// Returns the fractional part of x and sets i to the integer
|
||||
/// part (as a whole number floating point value). Both the
|
||||
@ -161,25 +162,22 @@ namespace glm
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/modf.xml">GLSL modf man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
|
||||
template <typename genType>
|
||||
GLM_FUNC_DECL genType modf(
|
||||
genType const & x,
|
||||
genType & i);
|
||||
GLM_FUNC_DECL genType modf(genType x, genType & i);
|
||||
|
||||
/// Returns y if y < x; otherwise, it returns x.
|
||||
///
|
||||
/// @tparam genType Floating-point or integer; scalar or vector types.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/min.xml">GLSL min man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a><<<<<<< HEAD
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
|
||||
template <typename genType>
|
||||
GLM_FUNC_DECL genType min(
|
||||
genType const & x,
|
||||
genType const & y);
|
||||
GLM_FUNC_DECL genType min(genType x, genType y);
|
||||
|
||||
template <typename genType>
|
||||
GLM_FUNC_DECL genType min(
|
||||
genType const & x,
|
||||
typename genType::value_type const & y);
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<T, P> min(vecType<T, P> const & x, T y);
|
||||
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<T, P> min(vecType<T, P> const & x, vecType<T, P> const & y);
|
||||
|
||||
/// Returns y if x < y; otherwise, it returns x.
|
||||
///
|
||||
@ -188,14 +186,13 @@ namespace glm
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/max.xml">GLSL max man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
|
||||
template <typename genType>
|
||||
GLM_FUNC_DECL genType max(
|
||||
genType const & x,
|
||||
genType const & y);
|
||||
GLM_FUNC_DECL genType max(genType x, genType y);
|
||||
|
||||
template <typename genType>
|
||||
GLM_FUNC_DECL genType max(
|
||||
genType const & x,
|
||||
typename genType::value_type const & y);
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<T, P> max(vecType<T, P> const & x, T y);
|
||||
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<T, P> max(vecType<T, P> const & x, vecType<T, P> const & y);
|
||||
|
||||
/// Returns min(max(x, minVal), maxVal) for each component in x
|
||||
/// using the floating-point values minVal and maxVal.
|
||||
@ -205,16 +202,13 @@ namespace glm
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/clamp.xml">GLSL clamp man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
|
||||
template <typename genType>
|
||||
GLM_FUNC_DECL genType clamp(
|
||||
genType const & x,
|
||||
genType const & minVal,
|
||||
genType const & maxVal);
|
||||
GLM_FUNC_DECL genType clamp(genType x, genType minVal, genType maxVal);
|
||||
|
||||
template <typename genType, precision P>
|
||||
GLM_FUNC_DECL genType clamp(
|
||||
genType const & x,
|
||||
typename genType::value_type const & minVal,
|
||||
typename genType::value_type const & maxVal);
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<T, P> clamp(vecType<T, P> const & x, T minVal, T maxVal);
|
||||
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<T, P> clamp(vecType<T, P> const & x, vecType<T, P> const & minVal, vecType<T, P> const & maxVal);
|
||||
|
||||
/// If genTypeU is a floating scalar or vector:
|
||||
/// Returns x * (1.0 - a) + y * a, i.e., the linear blend of
|
||||
@ -259,40 +253,34 @@ namespace glm
|
||||
/// glm::vec4 u = glm::mix(g, h, r); // Interpolations can be perform per component with a vector for the last parameter.
|
||||
/// @endcode
|
||||
template <typename T, typename U, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<T, P> mix(
|
||||
vecType<T, P> const & x,
|
||||
vecType<T, P> const & y,
|
||||
vecType<U, P> const & a);
|
||||
GLM_FUNC_DECL vecType<T, P> mix(vecType<T, P> const & x, vecType<T, P> const & y, vecType<U, P> const & a);
|
||||
|
||||
template <typename T, typename U, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<T, P> mix(
|
||||
vecType<T, P> const & x,
|
||||
vecType<T, P> const & y,
|
||||
U const & a);
|
||||
GLM_FUNC_DECL vecType<T, P> mix(vecType<T, P> const & x, vecType<T, P> const & y, U a);
|
||||
|
||||
template <typename genTypeT, typename genTypeU>
|
||||
GLM_FUNC_DECL genTypeT mix(
|
||||
genTypeT const & x,
|
||||
genTypeT const & y,
|
||||
genTypeU const & a);
|
||||
GLM_FUNC_DECL genTypeT mix(genTypeT x, genTypeT y, genTypeU a);
|
||||
|
||||
/// Returns 0.0 if x < edge, otherwise it returns 1.0 for each component of a genType.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/step.xml">GLSL step man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
|
||||
template <typename genType>
|
||||
GLM_FUNC_DECL genType step(
|
||||
genType const & edge,
|
||||
genType const & x);
|
||||
GLM_FUNC_DECL genType step(genType edge, genType x);
|
||||
|
||||
/// Returns 0.0 if x < edge, otherwise it returns 1.0.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/step.xml">GLSL step man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
|
||||
template <template <typename, precision> class vecType, typename T, precision P>
|
||||
GLM_FUNC_DECL vecType<T, P> step(
|
||||
T const & edge,
|
||||
vecType<T, P> const & x);
|
||||
GLM_FUNC_DECL vecType<T, P> step(T edge, vecType<T, P> const & x);
|
||||
|
||||
/// Returns 0.0 if x < edge, otherwise it returns 1.0.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/step.xml">GLSL step man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
|
||||
template <template <typename, precision> class vecType, typename T, precision P>
|
||||
GLM_FUNC_DECL vecType<T, P> step(vecType<T, P> const & edge, vecType<T, P> const & x);
|
||||
|
||||
/// Returns 0.0 if x <= edge0 and 1.0 if x >= edge1 and
|
||||
/// performs smooth Hermite interpolation between 0 and 1
|
||||
@ -309,16 +297,13 @@ namespace glm
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/smoothstep.xml">GLSL smoothstep man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
|
||||
template <typename genType>
|
||||
GLM_FUNC_DECL genType smoothstep(
|
||||
genType const & edge0,
|
||||
genType const & edge1,
|
||||
genType const & x);
|
||||
GLM_FUNC_DECL genType smoothstep(genType edge0, genType edge1, genType x);
|
||||
|
||||
template <typename genType>
|
||||
GLM_FUNC_DECL genType smoothstep(
|
||||
typename genType::value_type const & edge0,
|
||||
typename genType::value_type const & edge1,
|
||||
genType const & x);
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<T, P> smoothstep(T edge0, T edge1, vecType<T, P> const & x);
|
||||
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<T, P> smoothstep(vecType<T, P> const & edge0, vecType<T, P> const & edge1, vecType<T, P> const & x);
|
||||
|
||||
/// Returns true if x holds a NaN (not a number)
|
||||
/// representation in the underlying implementation's set of
|
||||
@ -332,8 +317,8 @@ namespace glm
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/isnan.xml">GLSL isnan man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
|
||||
template <typename genType>
|
||||
GLM_FUNC_DECL typename genType::bool_type isnan(genType const & x);
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<bool, P> isnan(vecType<T, P> const & x);
|
||||
|
||||
/// Returns true if x holds a positive infinity or negative
|
||||
/// infinity representation in the underlying implementation's
|
||||
@ -345,8 +330,8 @@ namespace glm
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/isinf.xml">GLSL isinf man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
|
||||
template <typename genType>
|
||||
GLM_FUNC_DECL typename genType::bool_type isinf(genType const & x);
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<bool, P> isinf(vecType<T, P> const & x);
|
||||
|
||||
/// Returns a signed integer value representing
|
||||
/// the encoding of a floating-point value. The floating-point
|
||||
@ -469,4 +454,3 @@ namespace glm
|
||||
|
||||
#include "func_common.inl"
|
||||
|
||||
#endif//GLM_FUNC_COMMON_INCLUDED
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -12,6 +12,10 @@
|
||||
/// 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
|
||||
@ -21,7 +25,7 @@
|
||||
/// THE SOFTWARE.
|
||||
///
|
||||
/// @ref core
|
||||
/// @file glm/core/func_exponential.hpp
|
||||
/// @file glm/detail/func_exponential.hpp
|
||||
/// @date 2008-08-08 / 2011-06-14
|
||||
/// @author Christophe Riccio
|
||||
///
|
||||
@ -33,8 +37,7 @@
|
||||
/// These all operate component-wise. The description is per component.
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef glm_core_func_exponential
|
||||
#define glm_core_func_exponential
|
||||
#pragma once
|
||||
|
||||
#include "type_vec1.hpp"
|
||||
#include "type_vec2.hpp"
|
||||
@ -49,84 +52,81 @@ namespace glm
|
||||
|
||||
/// Returns 'base' raised to the power 'exponent'.
|
||||
///
|
||||
/// @param base Floating point value. pow function is defined for input values of x defined in the range (inf-, inf+) in the limit of the type precision.
|
||||
/// @param base Floating point value. pow function is defined for input values of 'base' defined in the range (inf-, inf+) in the limit of the type precision.
|
||||
/// @param exponent Floating point value representing the 'exponent'.
|
||||
/// @tparam genType Floating-point scalar or vector types.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/pow.xml">GLSL pow man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.2 Exponential Functions</a>
|
||||
template <typename genType>
|
||||
GLM_FUNC_DECL genType pow(genType const & base, genType const & exponent);
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<T, P> pow(vecType<T, P> const & base, vecType<T, P> const & exponent);
|
||||
|
||||
/// Returns the natural exponentiation of x, i.e., e^x.
|
||||
///
|
||||
/// @param x exp function is defined for input values of x defined in the range (inf-, inf+) in the limit of the type precision.
|
||||
/// @param v exp function is defined for input values of v defined in the range (inf-, inf+) in the limit of the type precision.
|
||||
/// @tparam genType Floating-point scalar or vector types.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/exp.xml">GLSL exp man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.2 Exponential Functions</a>
|
||||
template <typename genType>
|
||||
GLM_FUNC_DECL genType exp(genType const & x);
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<T, P> exp(vecType<T, P> const & v);
|
||||
|
||||
/// Returns the natural logarithm of x, i.e.,
|
||||
/// Returns the natural logarithm of v, i.e.,
|
||||
/// returns the value y which satisfies the equation x = e^y.
|
||||
/// Results are undefined if x <= 0.
|
||||
/// Results are undefined if v <= 0.
|
||||
///
|
||||
/// @param x log function is defined for input values of x defined in the range (0, inf+) in the limit of the type precision.
|
||||
/// @param v log function is defined for input values of v defined in the range (0, inf+) in the limit of the type precision.
|
||||
/// @tparam genType Floating-point scalar or vector types.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/log.xml">GLSL log man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.2 Exponential Functions</a>
|
||||
template <typename genType>
|
||||
GLM_FUNC_DECL genType log(genType const & x);
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<T, P> log(vecType<T, P> const & v);
|
||||
|
||||
/// Returns 2 raised to the x power.
|
||||
/// Returns 2 raised to the v power.
|
||||
///
|
||||
/// @param x exp2 function is defined for input values of x defined in the range (inf-, inf+) in the limit of the type precision.
|
||||
/// @param v exp2 function is defined for input values of v defined in the range (inf-, inf+) in the limit of the type precision.
|
||||
/// @tparam genType Floating-point scalar or vector types.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/exp2.xml">GLSL exp2 man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.2 Exponential Functions</a>
|
||||
template <typename genType>
|
||||
GLM_FUNC_DECL genType exp2(genType const & x);
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<T, P> exp2(vecType<T, P> const & v);
|
||||
|
||||
/// Returns the base 2 log of x, i.e., returns the value y,
|
||||
/// which satisfies the equation x = 2 ^ y.
|
||||
///
|
||||
/// @param x log2 function is defined for input values of x defined in the range (0, inf+) in the limit of the type precision.
|
||||
/// @param v log2 function is defined for input values of v defined in the range (0, inf+) in the limit of the type precision.
|
||||
/// @tparam genType Floating-point scalar or vector types.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/log2.xml">GLSL log2 man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.2 Exponential Functions</a>
|
||||
template <typename genType>
|
||||
GLM_FUNC_DECL genType log2(genType x);
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<T, P> log2(vecType<T, P> const & v);
|
||||
|
||||
/// Returns the positive square root of x.
|
||||
/// Returns the positive square root of v.
|
||||
///
|
||||
/// @param x sqrt function is defined for input values of x defined in the range [0, inf+) in the limit of the type precision.
|
||||
/// @param v sqrt function is defined for input values of v defined in the range [0, inf+) in the limit of the type precision.
|
||||
/// @tparam genType Floating-point scalar or vector types.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/sqrt.xml">GLSL sqrt man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.2 Exponential Functions</a>
|
||||
//template <typename genType>
|
||||
//GLM_FUNC_DECL genType sqrt(genType const & x);
|
||||
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<T, P> sqrt(vecType<T, P> const & x);
|
||||
GLM_FUNC_DECL vecType<T, P> sqrt(vecType<T, P> const & v);
|
||||
|
||||
/// Returns the reciprocal of the positive square root of x.
|
||||
/// Returns the reciprocal of the positive square root of v.
|
||||
///
|
||||
/// @param x inversesqrt function is defined for input values of x defined in the range [0, inf+) in the limit of the type precision.
|
||||
/// @param v inversesqrt function is defined for input values of v defined in the range [0, inf+) in the limit of the type precision.
|
||||
/// @tparam genType Floating-point scalar or vector types.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/inversesqrt.xml">GLSL inversesqrt man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.2 Exponential Functions</a>
|
||||
template <typename genType>
|
||||
GLM_FUNC_DECL genType inversesqrt(genType const & x);
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<T, P> inversesqrt(vecType<T, P> const & v);
|
||||
|
||||
/// @}
|
||||
}//namespace glm
|
||||
|
||||
#include "func_exponential.inl"
|
||||
|
||||
#endif//glm_core_func_exponential
|
||||
|
||||
@ -12,6 +12,10 @@
|
||||
/// 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
|
||||
@ -21,7 +25,7 @@
|
||||
/// THE SOFTWARE.
|
||||
///
|
||||
/// @ref core
|
||||
/// @file glm/core/func_exponential.inl
|
||||
/// @file glm/detail/func_exponential.inl
|
||||
/// @date 2008-08-03 / 2011-06-15
|
||||
/// @author Christophe Riccio
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
@ -29,25 +33,28 @@
|
||||
#include "func_vector_relational.hpp"
|
||||
#include "_vectorize.hpp"
|
||||
#include <limits>
|
||||
#include <cmath>
|
||||
#include <cassert>
|
||||
|
||||
namespace glm{
|
||||
namespace detail
|
||||
{
|
||||
template <bool isFloat>
|
||||
# if GLM_HAS_CXX11_STL
|
||||
using std::log2;
|
||||
# else
|
||||
template <typename genType>
|
||||
genType log2(genType Value)
|
||||
{
|
||||
return std::log(Value) * static_cast<genType>(1.4426950408889634073599246810019);
|
||||
}
|
||||
# endif
|
||||
|
||||
template <typename T, precision P, template <class, precision> class vecType, bool isFloat = true>
|
||||
struct compute_log2
|
||||
{
|
||||
template <typename T>
|
||||
T operator() (T const & Value) const;
|
||||
};
|
||||
|
||||
template <>
|
||||
struct compute_log2<true>
|
||||
{
|
||||
template <typename T>
|
||||
GLM_FUNC_QUALIFIER T operator() (T const & Value) const
|
||||
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & vec)
|
||||
{
|
||||
return static_cast<T>(::std::log(Value)) * static_cast<T>(1.4426950408889634073599246810019);
|
||||
return detail::functor1<T, T, P, vecType>::call(log2, vec);
|
||||
}
|
||||
};
|
||||
|
||||
@ -78,170 +85,77 @@ namespace detail
|
||||
}//namespace detail
|
||||
|
||||
// pow
|
||||
template <typename genType>
|
||||
GLM_FUNC_QUALIFIER genType pow
|
||||
(
|
||||
genType const & x,
|
||||
genType const & y
|
||||
)
|
||||
using std::pow;
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<T, P> pow(vecType<T, P> const & base, vecType<T, P> const & exponent)
|
||||
{
|
||||
GLM_STATIC_ASSERT(
|
||||
std::numeric_limits<genType>::is_iec559,
|
||||
"'pow' only accept floating-point inputs");
|
||||
|
||||
return std::pow(x, y);
|
||||
return detail::functor2<T, P, vecType>::call(pow, base, exponent);
|
||||
}
|
||||
|
||||
VECTORIZE_VEC_VEC(pow)
|
||||
|
||||
// exp
|
||||
template <typename genType>
|
||||
GLM_FUNC_QUALIFIER genType exp
|
||||
(
|
||||
genType const & x
|
||||
)
|
||||
using std::exp;
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<T, P> exp(vecType<T, P> const & x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(
|
||||
std::numeric_limits<genType>::is_iec559,
|
||||
"'exp' only accept floating-point inputs");
|
||||
|
||||
return std::exp(x);
|
||||
return detail::functor1<T, T, P, vecType>::call(exp, x);
|
||||
}
|
||||
|
||||
VECTORIZE_VEC(exp)
|
||||
|
||||
// log
|
||||
template <typename genType>
|
||||
GLM_FUNC_QUALIFIER genType log
|
||||
(
|
||||
genType const & x
|
||||
)
|
||||
using std::log;
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<T, P> log(vecType<T, P> const & x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(
|
||||
std::numeric_limits<genType>::is_iec559,
|
||||
"'log' only accept floating-point inputs");
|
||||
|
||||
return std::log(x);
|
||||
return detail::functor1<T, T, P, vecType>::call(log, x);
|
||||
}
|
||||
|
||||
VECTORIZE_VEC(log)
|
||||
|
||||
//exp2, ln2 = 0.69314718055994530941723212145818f
|
||||
template <typename genType>
|
||||
GLM_FUNC_QUALIFIER genType exp2(genType const & x)
|
||||
GLM_FUNC_QUALIFIER genType exp2(genType x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(
|
||||
std::numeric_limits<genType>::is_iec559,
|
||||
"'exp2' only accept floating-point inputs");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'exp2' only accept floating-point inputs");
|
||||
|
||||
return std::exp(static_cast<genType>(0.69314718055994530941723212145818) * x);
|
||||
}
|
||||
|
||||
VECTORIZE_VEC(exp2)
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<T, P> exp2(vecType<T, P> const & x)
|
||||
{
|
||||
return detail::functor1<T, T, P, vecType>::call(exp2, x);
|
||||
}
|
||||
|
||||
// log2, ln2 = 0.69314718055994530941723212145818f
|
||||
template <typename genType>
|
||||
GLM_FUNC_QUALIFIER genType log2(genType x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559 || std::numeric_limits<genType>::is_integer,
|
||||
"GLM core 'log2' only accept floating-point inputs. Include <glm/gtx/integer.hpp> for additional integer support.");
|
||||
|
||||
assert(x > genType(0)); // log2 is only defined on the range (0, inf]
|
||||
return detail::compute_log2<std::numeric_limits<genType>::is_iec559>()(x);
|
||||
return log2(tvec1<genType>(x)).x;
|
||||
}
|
||||
|
||||
VECTORIZE_VEC(log2)
|
||||
|
||||
namespace detail
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<T, P> log2(vecType<T, P> const & x)
|
||||
{
|
||||
template <template <class, precision> class vecType, typename T, precision P>
|
||||
struct compute_sqrt{};
|
||||
|
||||
template <typename T, precision P>
|
||||
struct compute_sqrt<detail::tvec1, T, P>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static detail::tvec1<T, P> call(detail::tvec1<T, P> const & x)
|
||||
{
|
||||
return detail::tvec1<T, P>(std::sqrt(x.x));
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T, precision P>
|
||||
struct compute_sqrt<detail::tvec2, T, P>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static detail::tvec2<T, P> call(detail::tvec2<T, P> const & x)
|
||||
{
|
||||
return detail::tvec2<T, P>(std::sqrt(x.x), std::sqrt(x.y));
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T, precision P>
|
||||
struct compute_sqrt<detail::tvec3, T, P>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static detail::tvec3<T, P> call(detail::tvec3<T, P> const & x)
|
||||
{
|
||||
return detail::tvec3<T, P>(std::sqrt(x.x), std::sqrt(x.y), std::sqrt(x.z));
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T, precision P>
|
||||
struct compute_sqrt<detail::tvec4, T, P>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static detail::tvec4<T, P> call(detail::tvec4<T, P> const & x)
|
||||
{
|
||||
return detail::tvec4<T, P>(std::sqrt(x.x), std::sqrt(x.y), std::sqrt(x.z), std::sqrt(x.w));
|
||||
}
|
||||
};
|
||||
}//namespace detail
|
||||
|
||||
return detail::compute_log2<T, P, vecType, std::numeric_limits<T>::is_iec559>::call(x);
|
||||
}
|
||||
|
||||
// sqrt
|
||||
GLM_FUNC_QUALIFIER float sqrt(float x)
|
||||
{
|
||||
# ifdef __CUDACC__ // Wordaround for a CUDA compiler bug up to CUDA6
|
||||
detail::tvec1<float, highp> tmp(detail::compute_sqrt<detail::tvec1, float, highp>::call(x));
|
||||
return tmp.x;
|
||||
# else
|
||||
return detail::compute_sqrt<detail::tvec1, float, highp>::call(x).x;
|
||||
# endif
|
||||
}
|
||||
|
||||
GLM_FUNC_QUALIFIER double sqrt(double x)
|
||||
{
|
||||
# ifdef __CUDACC__ // Wordaround for a CUDA compiler bug up to CUDA6
|
||||
detail::tvec1<double, highp> tmp(detail::compute_sqrt<detail::tvec1, double, highp>::call(x));
|
||||
return tmp.x;
|
||||
# else
|
||||
return detail::compute_sqrt<detail::tvec1, double, highp>::call(x).x;
|
||||
# endif
|
||||
}
|
||||
|
||||
using std::sqrt;
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<T, P> sqrt(vecType<T, P> const & x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'sqrt' only accept floating-point inputs");
|
||||
return detail::compute_sqrt<vecType, T, P>::call(x);
|
||||
return detail::functor1<T, T, P, vecType>::call(sqrt, x);
|
||||
}
|
||||
|
||||
// inversesqrt
|
||||
GLM_FUNC_QUALIFIER float inversesqrt(float const & x)
|
||||
template <typename genType>
|
||||
GLM_FUNC_QUALIFIER genType inversesqrt(genType x)
|
||||
{
|
||||
return 1.0f / sqrt(x);
|
||||
return static_cast<genType>(1) / sqrt(x);
|
||||
}
|
||||
|
||||
GLM_FUNC_QUALIFIER double inversesqrt(double const & x)
|
||||
{
|
||||
return 1.0 / sqrt(x);
|
||||
}
|
||||
|
||||
template <template <class, precision> class vecType, typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER vecType<T, P> inversesqrt
|
||||
(
|
||||
vecType<T, P> const & x
|
||||
)
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<T, P> inversesqrt(vecType<T, P> const & x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'inversesqrt' only accept floating-point inputs");
|
||||
return detail::compute_inversesqrt<vecType, T, P>::call(x);
|
||||
}
|
||||
|
||||
VECTORIZE_VEC(inversesqrt)
|
||||
}//namespace glm
|
||||
|
||||
@ -12,6 +12,10 @@
|
||||
/// 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
|
||||
@ -21,7 +25,7 @@
|
||||
/// THE SOFTWARE.
|
||||
///
|
||||
/// @ref core
|
||||
/// @file glm/core/func_geometric.hpp
|
||||
/// @file glm/detail/func_geometric.hpp
|
||||
/// @date 2008-08-03 / 2011-06-14
|
||||
/// @author Christophe Riccio
|
||||
///
|
||||
@ -33,8 +37,7 @@
|
||||
/// These operate on vectors as vectors, not component-wise.
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef glm_core_func_geometric
|
||||
#define glm_core_func_geometric
|
||||
#pragma once
|
||||
|
||||
#include "type_vec3.hpp"
|
||||
|
||||
@ -49,9 +52,9 @@ namespace glm
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/length.xml">GLSL length man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.5 Geometric Functions</a>
|
||||
template <typename genType>
|
||||
GLM_FUNC_DECL typename genType::value_type length(
|
||||
genType const & x);
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL T length(
|
||||
vecType<T, P> const & x);
|
||||
|
||||
/// Returns the distance betwwen p0 and p1, i.e., length(p0 - p1).
|
||||
///
|
||||
@ -59,10 +62,10 @@ namespace glm
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/distance.xml">GLSL distance man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.5 Geometric Functions</a>
|
||||
template <typename genType>
|
||||
GLM_FUNC_DECL typename genType::value_type distance(
|
||||
genType const & p0,
|
||||
genType const & p1);
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL T distance(
|
||||
vecType<T, P> const & p0,
|
||||
vecType<T, P> const & p1);
|
||||
|
||||
/// Returns the dot product of x and y, i.e., result = x * y.
|
||||
///
|
||||
@ -75,17 +78,6 @@ namespace glm
|
||||
vecType<T, P> const & x,
|
||||
vecType<T, P> const & y);
|
||||
|
||||
/// Returns the dot product of x and y, i.e., result = x * y.
|
||||
///
|
||||
/// @tparam genType Floating-point vector types.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/dot.xml">GLSL dot man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.5 Geometric Functions</a>
|
||||
template <typename genType>
|
||||
GLM_FUNC_DECL genType dot(
|
||||
genType const & x,
|
||||
genType const & y);
|
||||
|
||||
/// Returns the cross product of x and y.
|
||||
///
|
||||
/// @tparam valType Floating-point scalar types.
|
||||
@ -93,17 +85,18 @@ namespace glm
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/cross.xml">GLSL cross man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.5 Geometric Functions</a>
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL detail::tvec3<T, P> cross(
|
||||
detail::tvec3<T, P> const & x,
|
||||
detail::tvec3<T, P> const & y);
|
||||
GLM_FUNC_DECL tvec3<T, P> cross(
|
||||
tvec3<T, P> const & x,
|
||||
tvec3<T, P> const & y);
|
||||
|
||||
/// Returns a vector in the same direction as x but with length of 1.
|
||||
/// According to issue 10 GLSL 1.10 specification, if length(x) == 0 then result is undefined and generate an error.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/normalize.xml">GLSL normalize man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.5 Geometric Functions</a>
|
||||
template <typename genType>
|
||||
GLM_FUNC_DECL genType normalize(
|
||||
genType const & x);
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<T, P> normalize(
|
||||
vecType<T, P> const & x);
|
||||
|
||||
/// If dot(Nref, I) < 0.0, return N, otherwise, return -N.
|
||||
///
|
||||
@ -141,11 +134,9 @@ namespace glm
|
||||
GLM_FUNC_DECL vecType<T, P> refract(
|
||||
vecType<T, P> const & I,
|
||||
vecType<T, P> const & N,
|
||||
T const & eta);
|
||||
T eta);
|
||||
|
||||
/// @}
|
||||
}//namespace glm
|
||||
|
||||
#include "func_geometric.inl"
|
||||
|
||||
#endif//glm_core_func_geometric
|
||||
|
||||
@ -12,6 +12,10 @@
|
||||
/// 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
|
||||
@ -21,7 +25,7 @@
|
||||
/// THE SOFTWARE.
|
||||
///
|
||||
/// @ref core
|
||||
/// @file glm/core/func_geometric.inl
|
||||
/// @file glm/detail/func_geometric.inl
|
||||
/// @date 2008-08-03 / 2011-06-15
|
||||
/// @author Christophe Riccio
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
@ -39,45 +43,40 @@ namespace detail
|
||||
struct compute_dot{};
|
||||
|
||||
template <typename T, precision P>
|
||||
struct compute_dot<detail::tvec1, T, P>
|
||||
struct compute_dot<tvec1, T, P>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static T call(detail::tvec1<T, P> const & x, detail::tvec1<T, P> const & y)
|
||||
GLM_FUNC_QUALIFIER static T call(tvec1<T, P> const & a, tvec1<T, P> const & b)
|
||||
{
|
||||
# ifdef __CUDACC__ // Wordaround for a CUDA compiler bug up to CUDA6
|
||||
detail::tvec1<T, P> tmp(x * y);
|
||||
return tmp.x;
|
||||
# else
|
||||
return detail::tvec1<T, P>(x * y).x;
|
||||
# endif
|
||||
return a.x * b.x;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T, precision P>
|
||||
struct compute_dot<detail::tvec2, T, P>
|
||||
struct compute_dot<tvec2, T, P>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static T call(detail::tvec2<T, P> const & x, detail::tvec2<T, P> const & y)
|
||||
GLM_FUNC_QUALIFIER static T call(tvec2<T, P> const & x, tvec2<T, P> const & y)
|
||||
{
|
||||
detail::tvec2<T, P> tmp(x * y);
|
||||
tvec2<T, P> tmp(x * y);
|
||||
return tmp.x + tmp.y;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T, precision P>
|
||||
struct compute_dot<detail::tvec3, T, P>
|
||||
struct compute_dot<tvec3, T, P>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static T call(detail::tvec3<T, P> const & x, detail::tvec3<T, P> const & y)
|
||||
GLM_FUNC_QUALIFIER static T call(tvec3<T, P> const & x, tvec3<T, P> const & y)
|
||||
{
|
||||
detail::tvec3<T, P> tmp(x * y);
|
||||
tvec3<T, P> tmp(x * y);
|
||||
return tmp.x + tmp.y + tmp.z;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T, precision P>
|
||||
struct compute_dot<detail::tvec4, T, P>
|
||||
struct compute_dot<tvec4, T, P>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static T call(detail::tvec4<T, P> const & x, detail::tvec4<T, P> const & y)
|
||||
GLM_FUNC_QUALIFIER static T call(tvec4<T, P> const & x, tvec4<T, P> const & y)
|
||||
{
|
||||
detail::tvec4<T, P> tmp(x * y);
|
||||
tvec4<T, P> tmp(x * y);
|
||||
return (tmp.x + tmp.y) + (tmp.z + tmp.w);
|
||||
}
|
||||
};
|
||||
@ -85,144 +84,58 @@ namespace detail
|
||||
|
||||
// length
|
||||
template <typename genType>
|
||||
GLM_FUNC_QUALIFIER genType length
|
||||
(
|
||||
genType const & x
|
||||
)
|
||||
GLM_FUNC_QUALIFIER genType length(genType x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'length' only accept floating-point inputs");
|
||||
|
||||
genType sqr = x * x;
|
||||
return sqrt(sqr);
|
||||
return abs(x);
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER T length(detail::tvec2<T, P> const & v)
|
||||
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");
|
||||
|
||||
T sqr = v.x * v.x + v.y * v.y;
|
||||
return sqrt(sqr);
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER T length(detail::tvec3<T, P> const & v)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'length' only accept floating-point inputs");
|
||||
|
||||
T sqr = v.x * v.x + v.y * v.y + v.z * v.z;
|
||||
return sqrt(sqr);
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER T length(detail::tvec4<T, P> const & v)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'length' only accept floating-point inputs");
|
||||
|
||||
T sqr = v.x * v.x + v.y * v.y + v.z * v.z + v.w * v.w;
|
||||
return sqrt(sqr);
|
||||
return sqrt(dot(v, v));
|
||||
}
|
||||
|
||||
// distance
|
||||
template <typename genType>
|
||||
GLM_FUNC_QUALIFIER genType distance
|
||||
(
|
||||
genType const & p0,
|
||||
genType const & p1
|
||||
)
|
||||
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");
|
||||
|
||||
return length(p1 - p0);
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER T distance
|
||||
(
|
||||
detail::tvec2<T, P> const & p0,
|
||||
detail::tvec2<T, P> const & p1
|
||||
)
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER T distance(vecType<T, P> const & p0, vecType<T, P> const & p1)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'distance' only accept floating-point inputs");
|
||||
|
||||
return length(p1 - p0);
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER T distance
|
||||
(
|
||||
detail::tvec3<T, P> const & p0,
|
||||
detail::tvec3<T, P> const & p1
|
||||
)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'distance' only accept floating-point inputs");
|
||||
|
||||
return length(p1 - p0);
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER T distance
|
||||
(
|
||||
detail::tvec4<T, P> const & p0,
|
||||
detail::tvec4<T, P> const & p1
|
||||
)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'distance' only accept floating-point inputs");
|
||||
|
||||
return length(p1 - p0);
|
||||
}
|
||||
|
||||
// dot
|
||||
template <typename T>
|
||||
GLM_FUNC_QUALIFIER T dot
|
||||
(
|
||||
T const & x,
|
||||
T const & y
|
||||
)
|
||||
GLM_FUNC_QUALIFIER T dot(T x, T y)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'dot' only accept floating-point inputs");
|
||||
return detail::compute_dot<detail::tvec1, T, highp>::call(x, y);
|
||||
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_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");
|
||||
return detail::compute_dot<vecType, T, P>::call(x, y);
|
||||
}
|
||||
|
||||
/* // SSE3
|
||||
GLM_FUNC_QUALIFIER float dot(const tvec4<float>& x, const tvec4<float>& y)
|
||||
{
|
||||
float Result;
|
||||
__asm
|
||||
{
|
||||
mov esi, x
|
||||
mov edi, y
|
||||
movaps xmm0, [esi]
|
||||
mulps xmm0, [edi]
|
||||
haddps( _xmm0, _xmm0 )
|
||||
haddps( _xmm0, _xmm0 )
|
||||
movss Result, xmm0
|
||||
}
|
||||
return Result;
|
||||
}
|
||||
*/
|
||||
// cross
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER detail::tvec3<T, P> cross
|
||||
(
|
||||
detail::tvec3<T, P> const & x,
|
||||
detail::tvec3<T, P> const & y
|
||||
)
|
||||
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");
|
||||
|
||||
return detail::tvec3<T, P>(
|
||||
return tvec3<T, P>(
|
||||
x.y * y.z - y.y * x.z,
|
||||
x.z * y.x - y.z * x.x,
|
||||
x.x * y.y - y.x * x.y);
|
||||
@ -230,111 +143,53 @@ namespace detail
|
||||
|
||||
// normalize
|
||||
template <typename genType>
|
||||
GLM_FUNC_QUALIFIER genType normalize
|
||||
(
|
||||
genType const & x
|
||||
)
|
||||
GLM_FUNC_QUALIFIER genType normalize(genType const & x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'normalize' only accept floating-point inputs");
|
||||
|
||||
return x < genType(0) ? genType(-1) : genType(1);
|
||||
}
|
||||
|
||||
// According to issue 10 GLSL 1.10 specification, if length(x) == 0 then result is undefine and generate an error
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER detail::tvec2<T, P> normalize
|
||||
(
|
||||
detail::tvec2<T, P> const & x
|
||||
)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'normalize' only accept floating-point inputs");
|
||||
|
||||
T sqr = x.x * x.x + x.y * x.y;
|
||||
return x * inversesqrt(sqr);
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER detail::tvec3<T, P> normalize
|
||||
(
|
||||
detail::tvec3<T, P> const & x
|
||||
)
|
||||
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");
|
||||
|
||||
T sqr = x.x * x.x + x.y * x.y + x.z * x.z;
|
||||
return x * inversesqrt(sqr);
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER detail::tvec4<T, P> normalize
|
||||
(
|
||||
detail::tvec4<T, P> const & x
|
||||
)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'normalize' only accept floating-point inputs");
|
||||
|
||||
T sqr = x.x * x.x + x.y * x.y + x.z * x.z + x.w * x.w;
|
||||
return x * inversesqrt(sqr);
|
||||
return x * inversesqrt(dot(x, x));
|
||||
}
|
||||
|
||||
// faceforward
|
||||
template <typename genType>
|
||||
GLM_FUNC_QUALIFIER genType faceforward
|
||||
(
|
||||
genType const & N,
|
||||
genType const & I,
|
||||
genType const & Nref
|
||||
)
|
||||
GLM_FUNC_QUALIFIER genType faceforward(genType const & N, genType const & I, genType const & Nref)
|
||||
{
|
||||
return dot(Nref, I) < 0 ? N : -N;
|
||||
return dot(Nref, I) < static_cast<genType>(0) ? N : -N;
|
||||
}
|
||||
|
||||
// reflect
|
||||
template <typename genType>
|
||||
GLM_FUNC_QUALIFIER genType reflect
|
||||
(
|
||||
genType const & I,
|
||||
genType const & N
|
||||
)
|
||||
GLM_FUNC_QUALIFIER genType reflect(genType const & I, genType const & N)
|
||||
{
|
||||
return I - N * dot(N, I) * genType(2);
|
||||
return I - N * dot(N, I) * static_cast<genType>(2);
|
||||
}
|
||||
|
||||
// refract
|
||||
template <typename genType>
|
||||
GLM_FUNC_QUALIFIER genType refract
|
||||
(
|
||||
genType const & I,
|
||||
genType const & N,
|
||||
genType const & eta
|
||||
)
|
||||
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");
|
||||
|
||||
genType dotValue = dot(N, I);
|
||||
genType k = genType(1) - eta * eta * (genType(1) - dotValue * dotValue);
|
||||
if(k < genType(0))
|
||||
return genType(0);
|
||||
else
|
||||
return eta * I - (eta * dotValue + sqrt(k)) * N;
|
||||
genType const dotValue(dot(N, I));
|
||||
genType const k(static_cast<genType>(1) - eta * eta * (static_cast<genType>(1) - dotValue * dotValue));
|
||||
return (eta * I - (eta * dotValue + sqrt(k)) * N) * static_cast<genType>(k >= static_cast<genType>(0));
|
||||
}
|
||||
|
||||
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 const & eta
|
||||
)
|
||||
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");
|
||||
|
||||
T dotValue = dot(N, I);
|
||||
T k = T(1) - eta * eta * (T(1) - dotValue * dotValue);
|
||||
if(k < T(0))
|
||||
return vecType<T, P>(0);
|
||||
else
|
||||
return eta * I - (eta * dotValue + std::sqrt(k)) * N;
|
||||
T const dotValue(dot(N, I));
|
||||
T const k(static_cast<T>(1) - eta * eta * (static_cast<T>(1) - dotValue * dotValue));
|
||||
return (eta * I - (eta * dotValue + std::sqrt(k)) * N) * static_cast<T>(k >= static_cast<T>(0));
|
||||
}
|
||||
|
||||
}//namespace glm
|
||||
|
||||
@ -12,6 +12,10 @@
|
||||
/// 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
|
||||
@ -21,7 +25,7 @@
|
||||
/// THE SOFTWARE.
|
||||
///
|
||||
/// @ref core
|
||||
/// @file glm/core/func_integer.hpp
|
||||
/// @file glm/detail/func_integer.hpp
|
||||
/// @date 2010-03-17 / 2011-06-18
|
||||
/// @author Christophe Riccio
|
||||
///
|
||||
@ -35,10 +39,12 @@
|
||||
/// b, inclusive. The lowest-order bit is bit 0.
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef glm_core_func_integer
|
||||
#define glm_core_func_integer
|
||||
#pragma once
|
||||
|
||||
#include "setup.hpp"
|
||||
#include "precision.hpp"
|
||||
#include "func_common.hpp"
|
||||
#include "func_vector_relational.hpp"
|
||||
|
||||
namespace glm
|
||||
{
|
||||
@ -53,11 +59,11 @@ namespace glm
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/uaddCarry.xml">GLSL uaddCarry man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.8 Integer Functions</a>
|
||||
template <typename genUType>
|
||||
GLM_FUNC_DECL genUType uaddCarry(
|
||||
genUType const & x,
|
||||
genUType const & y,
|
||||
genUType & carry);
|
||||
template <precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<uint, P> uaddCarry(
|
||||
vecType<uint, P> const & x,
|
||||
vecType<uint, P> const & y,
|
||||
vecType<uint, P> & carry);
|
||||
|
||||
/// Subtracts the 32-bit unsigned integer y from x, returning
|
||||
/// the difference if non-negative, or pow(2, 32) plus the difference
|
||||
@ -67,12 +73,12 @@ namespace glm
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/usubBorrow.xml">GLSL usubBorrow man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.8 Integer Functions</a>
|
||||
template <typename genUType>
|
||||
GLM_FUNC_DECL genUType usubBorrow(
|
||||
genUType const & x,
|
||||
genUType const & y,
|
||||
genUType & borrow);
|
||||
|
||||
template <precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<uint, P> usubBorrow(
|
||||
vecType<uint, P> const & x,
|
||||
vecType<uint, P> const & y,
|
||||
vecType<uint, P> & borrow);
|
||||
|
||||
/// Multiplies 32-bit integers x and y, producing a 64-bit
|
||||
/// result. The 32 least-significant bits are returned in lsb.
|
||||
/// The 32 most-significant bits are returned in msb.
|
||||
@ -81,12 +87,12 @@ namespace glm
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/umulExtended.xml">GLSL umulExtended man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.8 Integer Functions</a>
|
||||
template <typename genUType>
|
||||
template <precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL void umulExtended(
|
||||
genUType const & x,
|
||||
genUType const & y,
|
||||
genUType & msb,
|
||||
genUType & lsb);
|
||||
vecType<uint, P> const & x,
|
||||
vecType<uint, P> const & y,
|
||||
vecType<uint, P> & msb,
|
||||
vecType<uint, P> & lsb);
|
||||
|
||||
/// Multiplies 32-bit integers x and y, producing a 64-bit
|
||||
/// result. The 32 least-significant bits are returned in lsb.
|
||||
@ -96,12 +102,12 @@ namespace glm
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/imulExtended.xml">GLSL imulExtended man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.8 Integer Functions</a>
|
||||
template <typename genIType>
|
||||
template <precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL void imulExtended(
|
||||
genIType const & x,
|
||||
genIType const & y,
|
||||
genIType & msb,
|
||||
genIType & lsb);
|
||||
vecType<int, P> const & x,
|
||||
vecType<int, P> const & y,
|
||||
vecType<int, P> & msb,
|
||||
vecType<int, P> & lsb);
|
||||
|
||||
/// Extracts bits [offset, offset + bits - 1] from value,
|
||||
/// returning them in the least significant bits of the result.
|
||||
@ -114,15 +120,15 @@ namespace glm
|
||||
/// offset and bits is greater than the number of bits used
|
||||
/// to store the operand.
|
||||
///
|
||||
/// @tparam genIUType Signed or unsigned integer scalar or vector types.
|
||||
/// @tparam T Signed or unsigned integer scalar or vector types.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/bitfieldExtract.xml">GLSL bitfieldExtract man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.8 Integer Functions</a>
|
||||
template <typename genIUType>
|
||||
GLM_FUNC_DECL genIUType bitfieldExtract(
|
||||
genIUType const & Value,
|
||||
int const & Offset,
|
||||
int const & Bits);
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<T, P> bitfieldExtract(
|
||||
vecType<T, P> const & Value,
|
||||
int Offset,
|
||||
int Bits);
|
||||
|
||||
/// Returns the insertion the bits least-significant bits of insert into base.
|
||||
///
|
||||
@ -134,70 +140,93 @@ namespace glm
|
||||
/// offset and bits is greater than the number of bits used to
|
||||
/// store the operand.
|
||||
///
|
||||
/// @tparam genIUType Signed or unsigned integer scalar or vector types.
|
||||
/// @tparam T Signed or unsigned integer scalar or vector types.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/bitfieldInsert.xml">GLSL bitfieldInsert man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.8 Integer Functions</a>
|
||||
template <typename genIUType>
|
||||
GLM_FUNC_DECL genIUType bitfieldInsert(
|
||||
genIUType const & Base,
|
||||
genIUType const & Insert,
|
||||
int const & Offset,
|
||||
int const & Bits);
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<T, P> bitfieldInsert(
|
||||
vecType<T, P> const & Base,
|
||||
vecType<T, P> const & Insert,
|
||||
int Offset,
|
||||
int Bits);
|
||||
|
||||
/// Returns the reversal of the bits of value.
|
||||
/// The bit numbered n of the result will be taken from bit (bits - 1) - n of value,
|
||||
/// where bits is the total number of bits used to represent value.
|
||||
///
|
||||
/// @tparam genIUType Signed or unsigned integer scalar or vector types.
|
||||
/// @tparam T Signed or unsigned integer scalar or vector types.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/bitfieldReverse.xml">GLSL bitfieldReverse man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.8 Integer Functions</a>
|
||||
template <typename genIUType>
|
||||
GLM_FUNC_DECL genIUType bitfieldReverse(genIUType const & Value);
|
||||
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<T, P> bitfieldReverse(vecType<T, P> const & v);
|
||||
|
||||
/// Returns the number of bits set to 1 in the binary representation of value.
|
||||
///
|
||||
/// @tparam genIUType Signed or unsigned integer scalar or vector types.
|
||||
/// @tparam T Signed or unsigned integer scalar or vector types.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/bitCount.xml">GLSL bitCount man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.8 Integer Functions</a>
|
||||
template <typename genType>
|
||||
GLM_FUNC_DECL int bitCount(genType v);
|
||||
|
||||
/// Returns the number of bits set to 1 in the binary representation of value.
|
||||
///
|
||||
/// @todo Clarify the declaration to specify that scalars are suported.
|
||||
template <typename T, template <typename> class genIUType>
|
||||
GLM_FUNC_DECL typename genIUType<T>::signed_type bitCount(genIUType<T> const & Value);
|
||||
/// @tparam T Signed or unsigned integer scalar or vector types.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/bitCount.xml">GLSL bitCount man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.8 Integer Functions</a>
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<int, P> bitCount(vecType<T, P> const & v);
|
||||
|
||||
/// Returns the bit number of the least significant bit set to
|
||||
/// 1 in the binary representation of value.
|
||||
/// If value is zero, -1 will be returned.
|
||||
///
|
||||
/// @tparam genIUType Signed or unsigned integer scalar or vector types.
|
||||
/// @tparam T Signed or unsigned integer scalar types.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/findLSB.xml">GLSL findLSB man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.8 Integer Functions</a>
|
||||
template <typename genIUType>
|
||||
GLM_FUNC_DECL int findLSB(genIUType x);
|
||||
|
||||
/// Returns the bit number of the least significant bit set to
|
||||
/// 1 in the binary representation of value.
|
||||
/// If value is zero, -1 will be returned.
|
||||
///
|
||||
/// @todo Clarify the declaration to specify that scalars are suported.
|
||||
template <typename T, template <typename> class genIUType>
|
||||
GLM_FUNC_DECL typename genIUType<T>::signed_type findLSB(genIUType<T> const & Value);
|
||||
/// @tparam T Signed or unsigned integer scalar types.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/findLSB.xml">GLSL findLSB man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.8 Integer Functions</a>
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<int, P> findLSB(vecType<T, P> const & v);
|
||||
|
||||
/// Returns the bit number of the most significant bit in the binary representation of value.
|
||||
/// For positive integers, the result will be the bit number of the most significant bit set to 1.
|
||||
/// For negative integers, the result will be the bit number of the most significant
|
||||
/// bit set to 0. For a value of zero or negative one, -1 will be returned.
|
||||
///
|
||||
/// @tparam genIUType Signed or unsigned integer scalar or vector types.
|
||||
/// @tparam T Signed or unsigned integer scalar types.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/findMSB.xml">GLSL findMSB man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.8 Integer Functions</a>
|
||||
template <typename genIUType>
|
||||
GLM_FUNC_DECL int findMSB(genIUType x);
|
||||
|
||||
/// Returns the bit number of the most significant bit in the binary representation of value.
|
||||
/// For positive integers, the result will be the bit number of the most significant bit set to 1.
|
||||
/// For negative integers, the result will be the bit number of the most significant
|
||||
/// bit set to 0. For a value of zero or negative one, -1 will be returned.
|
||||
///
|
||||
/// @todo Clarify the declaration to specify that scalars are suported.
|
||||
template <typename T, template <typename> class genIUType>
|
||||
GLM_FUNC_DECL typename genIUType<T>::signed_type findMSB(genIUType<T> const & Value);
|
||||
/// @tparam T Signed or unsigned integer scalar types.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/findMSB.xml">GLSL findMSB man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.8 Integer Functions</a>
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<int, P> findMSB(vecType<T, P> const & v);
|
||||
|
||||
/// @}
|
||||
}//namespace glm
|
||||
|
||||
#include "func_integer.inl"
|
||||
|
||||
#endif//glm_core_func_integer
|
||||
|
||||
|
||||
@ -12,6 +12,10 @@
|
||||
/// 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
|
||||
@ -21,7 +25,7 @@
|
||||
/// THE SOFTWARE.
|
||||
///
|
||||
/// @ref core
|
||||
/// @file glm/core/func_integer.inl
|
||||
/// @file glm/detail/func_integer.inl
|
||||
/// @date 2010-03-17 / 2011-06-15
|
||||
/// @author Christophe Riccio
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
@ -39,73 +43,186 @@
|
||||
#endif//(GLM_ARCH != GLM_ARCH_PURE)
|
||||
#include <limits>
|
||||
|
||||
namespace glm
|
||||
namespace glm{
|
||||
namespace detail
|
||||
{
|
||||
template <typename T>
|
||||
GLM_FUNC_QUALIFIER T mask(T Bits)
|
||||
{
|
||||
return Bits >= sizeof(T) * 8 ? ~static_cast<T>(0) : (static_cast<T>(1) << Bits) - static_cast<T>(1);
|
||||
}
|
||||
|
||||
template <bool EXEC = false>
|
||||
struct compute_bitfieldReverseStep
|
||||
{
|
||||
template <typename T, glm::precision P, template <class, glm::precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & v, T, T)
|
||||
{
|
||||
return v;
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct compute_bitfieldReverseStep<true>
|
||||
{
|
||||
template <typename T, glm::precision P, template <class, glm::precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & v, T Mask, T Shift)
|
||||
{
|
||||
return (v & Mask) << Shift | (v & (~Mask)) >> Shift;
|
||||
}
|
||||
};
|
||||
|
||||
template <bool EXEC = false>
|
||||
struct compute_bitfieldBitCountStep
|
||||
{
|
||||
template <typename T, glm::precision P, template <class, glm::precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & v, T, T)
|
||||
{
|
||||
return v;
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct compute_bitfieldBitCountStep<true>
|
||||
{
|
||||
template <typename T, glm::precision P, template <class, glm::precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & v, T Mask, T Shift)
|
||||
{
|
||||
return (v & Mask) + ((v >> Shift) & Mask);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename genIUType, size_t Bits>
|
||||
struct compute_findLSB
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static int call(genIUType Value)
|
||||
{
|
||||
if(Value == 0)
|
||||
return -1;
|
||||
|
||||
return glm::bitCount(~Value & (Value - static_cast<genIUType>(1)));
|
||||
}
|
||||
};
|
||||
|
||||
# if GLM_HAS_BITSCAN_WINDOWS
|
||||
template <typename genIUType>
|
||||
struct compute_findLSB<genIUType, 32>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static int call(genIUType Value)
|
||||
{
|
||||
unsigned long Result(0);
|
||||
unsigned char IsNotNull = _BitScanForward(&Result, *reinterpret_cast<unsigned long*>(&Value));
|
||||
return IsNotNull ? int(Result) : -1;
|
||||
}
|
||||
};
|
||||
|
||||
# if !((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_MODEL == GLM_MODEL_32))
|
||||
template <typename genIUType>
|
||||
struct compute_findLSB<genIUType, 64>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static int call(genIUType Value)
|
||||
{
|
||||
unsigned long Result(0);
|
||||
unsigned char IsNotNull = _BitScanForward64(&Result, *reinterpret_cast<unsigned __int64*>(&Value));
|
||||
return IsNotNull ? int(Result) : -1;
|
||||
}
|
||||
};
|
||||
# endif
|
||||
# endif//GLM_HAS_BITSCAN_WINDOWS
|
||||
|
||||
template <typename T, glm::precision P, template <class, glm::precision> class vecType, bool EXEC = true>
|
||||
struct compute_findMSB_step_vec
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & x, T Shift)
|
||||
{
|
||||
return x | (x >> Shift);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T, glm::precision P, template <typename, glm::precision> class vecType>
|
||||
struct compute_findMSB_step_vec<T, P, vecType, false>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & x, T)
|
||||
{
|
||||
return x;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T, glm::precision P, template <typename, glm::precision> class vecType, int>
|
||||
struct compute_findMSB_vec
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<int, P> call(vecType<T, P> const & vec)
|
||||
{
|
||||
vecType<T, P> x(vec);
|
||||
x = compute_findMSB_step_vec<T, P, vecType, sizeof(T) * 8 >= 8>::call(x, static_cast<T>( 1));
|
||||
x = compute_findMSB_step_vec<T, P, vecType, sizeof(T) * 8 >= 8>::call(x, static_cast<T>( 2));
|
||||
x = compute_findMSB_step_vec<T, P, vecType, sizeof(T) * 8 >= 8>::call(x, static_cast<T>( 4));
|
||||
x = compute_findMSB_step_vec<T, P, vecType, sizeof(T) * 8 >= 16>::call(x, static_cast<T>( 8));
|
||||
x = compute_findMSB_step_vec<T, P, vecType, sizeof(T) * 8 >= 32>::call(x, static_cast<T>(16));
|
||||
x = compute_findMSB_step_vec<T, P, vecType, sizeof(T) * 8 >= 64>::call(x, static_cast<T>(32));
|
||||
return vecType<int, P>(sizeof(T) * 8 - 1) - glm::bitCount(~x);
|
||||
}
|
||||
};
|
||||
|
||||
# if GLM_HAS_BITSCAN_WINDOWS
|
||||
template <typename genIUType>
|
||||
GLM_FUNC_QUALIFIER int compute_findMSB_32(genIUType Value)
|
||||
{
|
||||
unsigned long Result(0);
|
||||
unsigned char IsNotNull = _BitScanReverse(&Result, *reinterpret_cast<unsigned long*>(&Value));
|
||||
return IsNotNull ? int(Result) : -1;
|
||||
}
|
||||
|
||||
template <typename T, glm::precision P, template <class, glm::precision> class vecType>
|
||||
struct compute_findMSB_vec<T, P, vecType, 32>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<int, P> call(vecType<T, P> const & x)
|
||||
{
|
||||
return detail::functor1<int, T, P, vecType>::call(compute_findMSB_32, x);
|
||||
}
|
||||
};
|
||||
|
||||
# if !((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_MODEL == GLM_MODEL_32))
|
||||
template <typename genIUType>
|
||||
GLM_FUNC_QUALIFIER int compute_findMSB_64(genIUType Value)
|
||||
{
|
||||
unsigned long Result(0);
|
||||
unsigned char IsNotNull = _BitScanReverse64(&Result, *reinterpret_cast<unsigned __int64*>(&Value));
|
||||
return IsNotNull ? int(Result) : -1;
|
||||
}
|
||||
|
||||
template <typename T, glm::precision P, template <class, glm::precision> class vecType>
|
||||
struct compute_findMSB_vec<T, P, vecType, 64>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<int, P> call(vecType<T, P> const & x)
|
||||
{
|
||||
return detail::functor1<int, T, P, vecType>::call(compute_findMSB_64, x);
|
||||
}
|
||||
};
|
||||
# endif
|
||||
# endif//GLM_HAS_BITSCAN_WINDOWS
|
||||
}//namespace detail
|
||||
|
||||
// uaddCarry
|
||||
template <>
|
||||
GLM_FUNC_QUALIFIER uint uaddCarry
|
||||
(
|
||||
uint const & x,
|
||||
uint const & y,
|
||||
uint & Carry
|
||||
)
|
||||
GLM_FUNC_QUALIFIER uint uaddCarry(uint const & x, uint const & y, uint & Carry)
|
||||
{
|
||||
uint64 Value64 = static_cast<uint64>(x) + static_cast<uint64>(y);
|
||||
uint32 Result = static_cast<uint32>(Value64 % (static_cast<uint64>(1) << static_cast<uint64>(32)));
|
||||
Carry = (Value64 % (static_cast<uint64>(1) << static_cast<uint64>(32))) > 1 ? static_cast<uint32>(1) : static_cast<uint32>(0);
|
||||
return Result;
|
||||
uint64 const Value64(static_cast<uint64>(x) + static_cast<uint64>(y));
|
||||
uint64 const Max32((static_cast<uint64>(1) << static_cast<uint64>(32)) - static_cast<uint64>(1));
|
||||
Carry = Value64 > Max32 ? 1 : 0;
|
||||
return static_cast<uint32>(Value64 % (Max32 + static_cast<uint64>(1)));
|
||||
}
|
||||
|
||||
template <>
|
||||
GLM_FUNC_QUALIFIER uvec2 uaddCarry
|
||||
(
|
||||
uvec2 const & x,
|
||||
uvec2 const & y,
|
||||
uvec2 & Carry
|
||||
)
|
||||
template <precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<uint, P> uaddCarry(vecType<uint, P> const & x, vecType<uint, P> const & y, vecType<uint, P> & Carry)
|
||||
{
|
||||
return uvec2(
|
||||
uaddCarry(x[0], y[0], Carry[0]),
|
||||
uaddCarry(x[1], y[1], Carry[1]));
|
||||
}
|
||||
|
||||
template <>
|
||||
GLM_FUNC_QUALIFIER uvec3 uaddCarry
|
||||
(
|
||||
uvec3 const & x,
|
||||
uvec3 const & y,
|
||||
uvec3 & Carry
|
||||
)
|
||||
{
|
||||
return uvec3(
|
||||
uaddCarry(x[0], y[0], Carry[0]),
|
||||
uaddCarry(x[1], y[1], Carry[1]),
|
||||
uaddCarry(x[2], y[2], Carry[2]));
|
||||
}
|
||||
|
||||
template <>
|
||||
GLM_FUNC_QUALIFIER uvec4 uaddCarry
|
||||
(
|
||||
uvec4 const & x,
|
||||
uvec4 const & y,
|
||||
uvec4 & Carry
|
||||
)
|
||||
{
|
||||
return uvec4(
|
||||
uaddCarry(x[0], y[0], Carry[0]),
|
||||
uaddCarry(x[1], y[1], Carry[1]),
|
||||
uaddCarry(x[2], y[2], Carry[2]),
|
||||
uaddCarry(x[3], y[3], Carry[3]));
|
||||
vecType<uint64, P> Value64(vecType<uint64, P>(x) + vecType<uint64, P>(y));
|
||||
vecType<uint64, P> Max32((static_cast<uint64>(1) << static_cast<uint64>(32)) - static_cast<uint64>(1));
|
||||
Carry = mix(vecType<uint32, P>(0), vecType<uint32, P>(1), greaterThan(Value64, Max32));
|
||||
return vecType<uint32,P>(Value64 % (Max32 + static_cast<uint64>(1)));
|
||||
}
|
||||
|
||||
// usubBorrow
|
||||
template <>
|
||||
GLM_FUNC_QUALIFIER uint usubBorrow
|
||||
(
|
||||
uint const & x,
|
||||
uint const & y,
|
||||
uint & Borrow
|
||||
)
|
||||
GLM_FUNC_QUALIFIER uint usubBorrow(uint const & x, uint const & y, uint & Borrow)
|
||||
{
|
||||
GLM_STATIC_ASSERT(sizeof(uint) == sizeof(uint32), "uint and uint32 size mismatch");
|
||||
|
||||
@ -116,57 +233,17 @@ namespace glm
|
||||
return static_cast<uint32>((static_cast<int64>(1) << static_cast<int64>(32)) + (static_cast<int64>(y) - static_cast<int64>(x)));
|
||||
}
|
||||
|
||||
template <>
|
||||
GLM_FUNC_QUALIFIER uvec2 usubBorrow
|
||||
(
|
||||
uvec2 const & x,
|
||||
uvec2 const & y,
|
||||
uvec2 & Borrow
|
||||
)
|
||||
template <precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<uint, P> usubBorrow(vecType<uint, P> const & x, vecType<uint, P> const & y, vecType<uint, P> & Borrow)
|
||||
{
|
||||
return uvec2(
|
||||
usubBorrow(x[0], y[0], Borrow[0]),
|
||||
usubBorrow(x[1], y[1], Borrow[1]));
|
||||
}
|
||||
|
||||
template <>
|
||||
GLM_FUNC_QUALIFIER uvec3 usubBorrow
|
||||
(
|
||||
uvec3 const & x,
|
||||
uvec3 const & y,
|
||||
uvec3 & Borrow
|
||||
)
|
||||
{
|
||||
return uvec3(
|
||||
usubBorrow(x[0], y[0], Borrow[0]),
|
||||
usubBorrow(x[1], y[1], Borrow[1]),
|
||||
usubBorrow(x[2], y[2], Borrow[2]));
|
||||
}
|
||||
|
||||
template <>
|
||||
GLM_FUNC_QUALIFIER uvec4 usubBorrow
|
||||
(
|
||||
uvec4 const & x,
|
||||
uvec4 const & y,
|
||||
uvec4 & Borrow
|
||||
)
|
||||
{
|
||||
return uvec4(
|
||||
usubBorrow(x[0], y[0], Borrow[0]),
|
||||
usubBorrow(x[1], y[1], Borrow[1]),
|
||||
usubBorrow(x[2], y[2], Borrow[2]),
|
||||
usubBorrow(x[3], y[3], Borrow[3]));
|
||||
Borrow = mix(vecType<uint, P>(1), vecType<uint, P>(0), greaterThanEqual(x, y));
|
||||
vecType<uint, P> const YgeX(y - x);
|
||||
vecType<uint, P> const XgeY(vecType<uint32, P>((static_cast<int64>(1) << static_cast<int64>(32)) + (vecType<int64, P>(y) - vecType<int64, P>(x))));
|
||||
return mix(XgeY, YgeX, greaterThanEqual(y, x));
|
||||
}
|
||||
|
||||
// umulExtended
|
||||
template <>
|
||||
GLM_FUNC_QUALIFIER void umulExtended
|
||||
(
|
||||
uint const & x,
|
||||
uint const & y,
|
||||
uint & msb,
|
||||
uint & lsb
|
||||
)
|
||||
GLM_FUNC_QUALIFIER void umulExtended(uint const & x, uint const & y, uint & msb, uint & lsb)
|
||||
{
|
||||
GLM_STATIC_ASSERT(sizeof(uint) == sizeof(uint32), "uint and uint32 size mismatch");
|
||||
|
||||
@ -177,57 +254,18 @@ namespace glm
|
||||
lsb = *PointerLSB;
|
||||
}
|
||||
|
||||
template <>
|
||||
GLM_FUNC_QUALIFIER void umulExtended
|
||||
(
|
||||
uvec2 const & x,
|
||||
uvec2 const & y,
|
||||
uvec2 & msb,
|
||||
uvec2 & lsb
|
||||
)
|
||||
template <precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER void umulExtended(vecType<uint, P> const & x, vecType<uint, P> const & y, vecType<uint, P> & msb, vecType<uint, P> & lsb)
|
||||
{
|
||||
umulExtended(x[0], y[0], msb[0], lsb[0]);
|
||||
umulExtended(x[1], y[1], msb[1], lsb[1]);
|
||||
}
|
||||
GLM_STATIC_ASSERT(sizeof(uint) == sizeof(uint32), "uint and uint32 size mismatch");
|
||||
|
||||
template <>
|
||||
GLM_FUNC_QUALIFIER void umulExtended
|
||||
(
|
||||
uvec3 const & x,
|
||||
uvec3 const & y,
|
||||
uvec3 & msb,
|
||||
uvec3 & lsb
|
||||
)
|
||||
{
|
||||
umulExtended(x[0], y[0], msb[0], lsb[0]);
|
||||
umulExtended(x[1], y[1], msb[1], lsb[1]);
|
||||
umulExtended(x[2], y[2], msb[2], lsb[2]);
|
||||
}
|
||||
|
||||
template <>
|
||||
GLM_FUNC_QUALIFIER void umulExtended
|
||||
(
|
||||
uvec4 const & x,
|
||||
uvec4 const & y,
|
||||
uvec4 & msb,
|
||||
uvec4 & lsb
|
||||
)
|
||||
{
|
||||
umulExtended(x[0], y[0], msb[0], lsb[0]);
|
||||
umulExtended(x[1], y[1], msb[1], lsb[1]);
|
||||
umulExtended(x[2], y[2], msb[2], lsb[2]);
|
||||
umulExtended(x[3], y[3], msb[3], lsb[3]);
|
||||
vecType<uint64, P> Value64(vecType<uint64, P>(x) * vecType<uint64, P>(y));
|
||||
msb = vecType<uint32, P>(Value64 >> static_cast<uint64>(32));
|
||||
lsb = vecType<uint32, P>(Value64);
|
||||
}
|
||||
|
||||
// imulExtended
|
||||
template <>
|
||||
GLM_FUNC_QUALIFIER void imulExtended
|
||||
(
|
||||
int const & x,
|
||||
int const & y,
|
||||
int & msb,
|
||||
int & lsb
|
||||
)
|
||||
GLM_FUNC_QUALIFIER void imulExtended(int x, int y, int & msb, int & lsb)
|
||||
{
|
||||
GLM_STATIC_ASSERT(sizeof(int) == sizeof(int32), "int and int32 size mismatch");
|
||||
|
||||
@ -238,417 +276,118 @@ namespace glm
|
||||
lsb = *PointerLSB;
|
||||
}
|
||||
|
||||
template <>
|
||||
GLM_FUNC_QUALIFIER void imulExtended
|
||||
(
|
||||
ivec2 const & x,
|
||||
ivec2 const & y,
|
||||
ivec2 & msb,
|
||||
ivec2 & lsb
|
||||
)
|
||||
template <precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER void imulExtended(vecType<int, P> const & x, vecType<int, P> const & y, vecType<int, P> & msb, vecType<int, P> & lsb)
|
||||
{
|
||||
imulExtended(x[0], y[0], msb[0], lsb[0]),
|
||||
imulExtended(x[1], y[1], msb[1], lsb[1]);
|
||||
}
|
||||
GLM_STATIC_ASSERT(sizeof(int) == sizeof(int32), "int and int32 size mismatch");
|
||||
|
||||
template <>
|
||||
GLM_FUNC_QUALIFIER void imulExtended
|
||||
(
|
||||
ivec3 const & x,
|
||||
ivec3 const & y,
|
||||
ivec3 & msb,
|
||||
ivec3 & lsb
|
||||
)
|
||||
{
|
||||
imulExtended(x[0], y[0], msb[0], lsb[0]),
|
||||
imulExtended(x[1], y[1], msb[1], lsb[1]);
|
||||
imulExtended(x[2], y[2], msb[2], lsb[2]);
|
||||
}
|
||||
|
||||
template <>
|
||||
GLM_FUNC_QUALIFIER void imulExtended
|
||||
(
|
||||
ivec4 const & x,
|
||||
ivec4 const & y,
|
||||
ivec4 & msb,
|
||||
ivec4 & lsb
|
||||
)
|
||||
{
|
||||
imulExtended(x[0], y[0], msb[0], lsb[0]),
|
||||
imulExtended(x[1], y[1], msb[1], lsb[1]);
|
||||
imulExtended(x[2], y[2], msb[2], lsb[2]);
|
||||
imulExtended(x[3], y[3], msb[3], lsb[3]);
|
||||
vecType<int64, P> Value64(vecType<int64, P>(x) * vecType<int64, P>(y));
|
||||
lsb = vecType<int32, P>(Value64 & static_cast<int64>(0xFFFFFFFF));
|
||||
msb = vecType<int32, P>((Value64 >> static_cast<int64>(32)) & static_cast<int64>(0xFFFFFFFF));
|
||||
}
|
||||
|
||||
// bitfieldExtract
|
||||
template <typename genIUType>
|
||||
GLM_FUNC_QUALIFIER genIUType bitfieldExtract
|
||||
(
|
||||
genIUType const & Value,
|
||||
int const & Offset,
|
||||
int const & Bits
|
||||
)
|
||||
GLM_FUNC_QUALIFIER genIUType bitfieldExtract(genIUType Value, int Offset, int Bits)
|
||||
{
|
||||
int GenSize = int(sizeof(genIUType)) << int(3);
|
||||
|
||||
assert(Offset + Bits <= GenSize);
|
||||
|
||||
genIUType ShiftLeft = Bits ? Value << (GenSize - (Bits + Offset)) : genIUType(0);
|
||||
genIUType ShiftBack = ShiftLeft >> genIUType(GenSize - Bits);
|
||||
|
||||
return ShiftBack;
|
||||
return bitfieldExtract(tvec1<genIUType>(Value), Offset, Bits).x;
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER detail::tvec2<T, P> bitfieldExtract
|
||||
(
|
||||
detail::tvec2<T, P> const & Value,
|
||||
int const & Offset,
|
||||
int const & Bits
|
||||
)
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<T, P> bitfieldExtract(vecType<T, P> const & Value, int Offset, int Bits)
|
||||
{
|
||||
return detail::tvec2<T, P>(
|
||||
bitfieldExtract(Value[0], Offset, Bits),
|
||||
bitfieldExtract(Value[1], Offset, Bits));
|
||||
}
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_integer, "'bitfieldExtract' only accept integer inputs");
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER detail::tvec3<T, P> bitfieldExtract
|
||||
(
|
||||
detail::tvec3<T, P> const & Value,
|
||||
int const & Offset,
|
||||
int const & Bits
|
||||
)
|
||||
{
|
||||
return detail::tvec3<T, P>(
|
||||
bitfieldExtract(Value[0], Offset, Bits),
|
||||
bitfieldExtract(Value[1], Offset, Bits),
|
||||
bitfieldExtract(Value[2], Offset, Bits));
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER detail::tvec4<T, P> bitfieldExtract
|
||||
(
|
||||
detail::tvec4<T, P> const & Value,
|
||||
int const & Offset,
|
||||
int const & Bits
|
||||
)
|
||||
{
|
||||
return detail::tvec4<T, P>(
|
||||
bitfieldExtract(Value[0], Offset, Bits),
|
||||
bitfieldExtract(Value[1], Offset, Bits),
|
||||
bitfieldExtract(Value[2], Offset, Bits),
|
||||
bitfieldExtract(Value[3], Offset, Bits));
|
||||
return (Value >> static_cast<T>(Offset)) & static_cast<T>(detail::mask(Bits));
|
||||
}
|
||||
|
||||
// bitfieldInsert
|
||||
template <typename genIUType>
|
||||
GLM_FUNC_QUALIFIER genIUType bitfieldInsert
|
||||
(
|
||||
genIUType const & Base,
|
||||
genIUType const & Insert,
|
||||
int const & Offset,
|
||||
int const & Bits
|
||||
)
|
||||
GLM_FUNC_QUALIFIER genIUType bitfieldInsert(genIUType const & Base, genIUType const & Insert, int Offset, int Bits)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genIUType>::is_integer, "'bitfieldInsert' only accept integer values");
|
||||
assert(Offset + Bits <= sizeof(genIUType));
|
||||
return bitfieldInsert(tvec1<genIUType>(Base), tvec1<genIUType>(Insert), Offset, Bits).x;
|
||||
}
|
||||
|
||||
if(Bits == 0)
|
||||
return Base;
|
||||
|
||||
genIUType Mask = 0;
|
||||
for(int Bit = Offset; Bit < Offset + Bits; ++Bit)
|
||||
Mask |= (1 << Bit);
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<T, P> bitfieldInsert(vecType<T, P> const & Base, vecType<T, P> const & Insert, int Offset, int Bits)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_integer, "'bitfieldInsert' only accept integer values");
|
||||
|
||||
T const Mask = static_cast<T>(detail::mask(Bits) << Offset);
|
||||
return (Base & ~Mask) | (Insert & Mask);
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER detail::tvec2<T, P> bitfieldInsert
|
||||
(
|
||||
detail::tvec2<T, P> const & Base,
|
||||
detail::tvec2<T, P> const & Insert,
|
||||
int const & Offset,
|
||||
int const & Bits
|
||||
)
|
||||
{
|
||||
return detail::tvec2<T, P>(
|
||||
bitfieldInsert(Base[0], Insert[0], Offset, Bits),
|
||||
bitfieldInsert(Base[1], Insert[1], Offset, Bits));
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER detail::tvec3<T, P> bitfieldInsert
|
||||
(
|
||||
detail::tvec3<T, P> const & Base,
|
||||
detail::tvec3<T, P> const & Insert,
|
||||
int const & Offset,
|
||||
int const & Bits
|
||||
)
|
||||
{
|
||||
return detail::tvec3<T, P>(
|
||||
bitfieldInsert(Base[0], Insert[0], Offset, Bits),
|
||||
bitfieldInsert(Base[1], Insert[1], Offset, Bits),
|
||||
bitfieldInsert(Base[2], Insert[2], Offset, Bits));
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER detail::tvec4<T, P> bitfieldInsert
|
||||
(
|
||||
detail::tvec4<T, P> const & Base,
|
||||
detail::tvec4<T, P> const & Insert,
|
||||
int const & Offset,
|
||||
int const & Bits
|
||||
)
|
||||
{
|
||||
return detail::tvec4<T, P>(
|
||||
bitfieldInsert(Base[0], Insert[0], Offset, Bits),
|
||||
bitfieldInsert(Base[1], Insert[1], Offset, Bits),
|
||||
bitfieldInsert(Base[2], Insert[2], Offset, Bits),
|
||||
bitfieldInsert(Base[3], Insert[3], Offset, Bits));
|
||||
}
|
||||
|
||||
// bitfieldReverse
|
||||
template <typename genIUType>
|
||||
GLM_FUNC_QUALIFIER genIUType bitfieldReverse(genIUType const & Value)
|
||||
template <typename genType>
|
||||
GLM_FUNC_QUALIFIER genType bitfieldReverse(genType x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genIUType>::is_integer, "'bitfieldReverse' only accept integer values");
|
||||
return bitfieldReverse(glm::tvec1<genType, glm::defaultp>(x)).x;
|
||||
}
|
||||
|
||||
genIUType Out = 0;
|
||||
std::size_t BitSize = sizeof(genIUType) * 8;
|
||||
for(std::size_t i = 0; i < BitSize; ++i)
|
||||
if(Value & (genIUType(1) << i))
|
||||
Out |= genIUType(1) << (BitSize - 1 - i);
|
||||
return Out;
|
||||
}
|
||||
|
||||
VECTORIZE_VEC(bitfieldReverse)
|
||||
template <typename T, glm::precision P, template <typename, glm::precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<T, P> bitfieldReverse(vecType<T, P> const & v)
|
||||
{
|
||||
vecType<T, P> x(v);
|
||||
x = detail::compute_bitfieldReverseStep<sizeof(T) * 8 >= 2>::call(x, T(0x5555555555555555ull), static_cast<T>( 1));
|
||||
x = detail::compute_bitfieldReverseStep<sizeof(T) * 8 >= 4>::call(x, T(0x3333333333333333ull), static_cast<T>( 2));
|
||||
x = detail::compute_bitfieldReverseStep<sizeof(T) * 8 >= 8>::call(x, T(0x0F0F0F0F0F0F0F0Full), static_cast<T>( 4));
|
||||
x = detail::compute_bitfieldReverseStep<sizeof(T) * 8 >= 16>::call(x, T(0x00FF00FF00FF00FFull), static_cast<T>( 8));
|
||||
x = detail::compute_bitfieldReverseStep<sizeof(T) * 8 >= 32>::call(x, T(0x0000FFFF0000FFFFull), static_cast<T>(16));
|
||||
x = detail::compute_bitfieldReverseStep<sizeof(T) * 8 >= 64>::call(x, T(0x00000000FFFFFFFFull), static_cast<T>(32));
|
||||
return x;
|
||||
}
|
||||
|
||||
// bitCount
|
||||
template <typename genIUType>
|
||||
GLM_FUNC_QUALIFIER int bitCount(genIUType const & Value)
|
||||
template <typename genType>
|
||||
GLM_FUNC_QUALIFIER int bitCount(genType x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genIUType>::is_integer, "'bitCount' only accept integer values");
|
||||
|
||||
int Count = 0;
|
||||
for(std::size_t i = 0; i < sizeof(genIUType) * std::size_t(8); ++i)
|
||||
{
|
||||
if(Value & (1 << i))
|
||||
++Count;
|
||||
}
|
||||
return Count;
|
||||
return bitCount(glm::tvec1<genType, glm::defaultp>(x)).x;
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER detail::tvec2<int, P> bitCount
|
||||
(
|
||||
detail::tvec2<T, P> const & value
|
||||
)
|
||||
template <typename T, glm::precision P, template <typename, glm::precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<int, P> bitCount(vecType<T, P> const & v)
|
||||
{
|
||||
return detail::tvec2<int, P>(
|
||||
bitCount(value[0]),
|
||||
bitCount(value[1]));
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER detail::tvec3<int, P> bitCount
|
||||
(
|
||||
detail::tvec3<T, P> const & value
|
||||
)
|
||||
{
|
||||
return detail::tvec3<int, P>(
|
||||
bitCount(value[0]),
|
||||
bitCount(value[1]),
|
||||
bitCount(value[2]));
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER detail::tvec4<int, P> bitCount
|
||||
(
|
||||
detail::tvec4<T, P> const & value
|
||||
)
|
||||
{
|
||||
return detail::tvec4<int, P>(
|
||||
bitCount(value[0]),
|
||||
bitCount(value[1]),
|
||||
bitCount(value[2]),
|
||||
bitCount(value[3]));
|
||||
vecType<typename detail::make_unsigned<T>::type, P> x(*reinterpret_cast<vecType<typename detail::make_unsigned<T>::type, P> const *>(&v));
|
||||
x = detail::compute_bitfieldBitCountStep<sizeof(T) * 8 >= 2>::call(x, typename detail::make_unsigned<T>::type(0x5555555555555555ull), typename detail::make_unsigned<T>::type( 1));
|
||||
x = detail::compute_bitfieldBitCountStep<sizeof(T) * 8 >= 4>::call(x, typename detail::make_unsigned<T>::type(0x3333333333333333ull), typename detail::make_unsigned<T>::type( 2));
|
||||
x = detail::compute_bitfieldBitCountStep<sizeof(T) * 8 >= 8>::call(x, typename detail::make_unsigned<T>::type(0x0F0F0F0F0F0F0F0Full), typename detail::make_unsigned<T>::type( 4));
|
||||
x = detail::compute_bitfieldBitCountStep<sizeof(T) * 8 >= 16>::call(x, typename detail::make_unsigned<T>::type(0x00FF00FF00FF00FFull), typename detail::make_unsigned<T>::type( 8));
|
||||
x = detail::compute_bitfieldBitCountStep<sizeof(T) * 8 >= 32>::call(x, typename detail::make_unsigned<T>::type(0x0000FFFF0000FFFFull), typename detail::make_unsigned<T>::type(16));
|
||||
x = detail::compute_bitfieldBitCountStep<sizeof(T) * 8 >= 64>::call(x, typename detail::make_unsigned<T>::type(0x00000000FFFFFFFFull), typename detail::make_unsigned<T>::type(32));
|
||||
return vecType<int, P>(x);
|
||||
}
|
||||
|
||||
// findLSB
|
||||
template <typename genIUType>
|
||||
GLM_FUNC_QUALIFIER int findLSB
|
||||
(
|
||||
genIUType const & Value
|
||||
)
|
||||
GLM_FUNC_QUALIFIER int findLSB(genIUType Value)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genIUType>::is_integer, "'findLSB' only accept integer values");
|
||||
if(Value == 0)
|
||||
return -1;
|
||||
|
||||
genIUType Bit;
|
||||
for(Bit = genIUType(0); !(Value & (1 << Bit)); ++Bit){}
|
||||
return Bit;
|
||||
return detail::compute_findLSB<genIUType, sizeof(genIUType) * 8>::call(Value);
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER detail::tvec2<int, P> findLSB
|
||||
(
|
||||
detail::tvec2<T, P> const & value
|
||||
)
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<int, P> findLSB(vecType<T, P> const & x)
|
||||
{
|
||||
return detail::tvec2<int, P>(
|
||||
findLSB(value[0]),
|
||||
findLSB(value[1]));
|
||||
}
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_integer, "'findLSB' only accept integer values");
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER detail::tvec3<int, P> findLSB
|
||||
(
|
||||
detail::tvec3<T, P> const & value
|
||||
)
|
||||
{
|
||||
return detail::tvec3<int, P>(
|
||||
findLSB(value[0]),
|
||||
findLSB(value[1]),
|
||||
findLSB(value[2]));
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER detail::tvec4<int, P> findLSB
|
||||
(
|
||||
detail::tvec4<T, P> const & value
|
||||
)
|
||||
{
|
||||
return detail::tvec4<int, P>(
|
||||
findLSB(value[0]),
|
||||
findLSB(value[1]),
|
||||
findLSB(value[2]),
|
||||
findLSB(value[3]));
|
||||
return detail::functor1<int, T, P, vecType>::call(findLSB, x);
|
||||
}
|
||||
|
||||
// findMSB
|
||||
#if((GLM_ARCH != GLM_ARCH_PURE) && (GLM_COMPILER & GLM_COMPILER_VC))
|
||||
|
||||
template <typename genIUType>
|
||||
GLM_FUNC_QUALIFIER int findMSB
|
||||
(
|
||||
genIUType const & Value
|
||||
)
|
||||
GLM_FUNC_QUALIFIER int findMSB(genIUType x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genIUType>::is_integer, "'findMSB' only accept integer values");
|
||||
if(Value == 0)
|
||||
return -1;
|
||||
|
||||
unsigned long Result(0);
|
||||
_BitScanReverse(&Result, Value);
|
||||
return int(Result);
|
||||
}
|
||||
/*
|
||||
// __builtin_clz seems to be buggy as it crasks for some values, from 0x00200000 to 80000000
|
||||
#elif((GLM_ARCH != GLM_ARCH_PURE) && (GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC40))
|
||||
|
||||
template <typename genIUType>
|
||||
GLM_FUNC_QUALIFIER int findMSB
|
||||
(
|
||||
genIUType const & Value
|
||||
)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genIUType>::is_integer, "'findMSB' only accept integer values");
|
||||
if(Value == 0)
|
||||
return -1;
|
||||
|
||||
// clz returns the number or trailing 0-bits; see
|
||||
// http://gcc.gnu.org/onlinedocs/gcc-4.7.1/gcc/Other-Builtins.html
|
||||
//
|
||||
// NoteBecause __builtin_clz only works for unsigned ints, this
|
||||
// implementation will not work for 64-bit integers.
|
||||
//
|
||||
return 31 - __builtin_clzl(Value);
|
||||
}
|
||||
*/
|
||||
#else
|
||||
|
||||
/* SSE implementation idea
|
||||
|
||||
__m128i const Zero = _mm_set_epi32( 0, 0, 0, 0);
|
||||
__m128i const One = _mm_set_epi32( 1, 1, 1, 1);
|
||||
__m128i Bit = _mm_set_epi32(-1, -1, -1, -1);
|
||||
__m128i Tmp = _mm_set_epi32(Value, Value, Value, Value);
|
||||
__m128i Mmi = Zero;
|
||||
for(int i = 0; i < 32; ++i)
|
||||
{
|
||||
__m128i Shilt = _mm_and_si128(_mm_cmpgt_epi32(Tmp, One), One);
|
||||
Tmp = _mm_srai_epi32(Tmp, One);
|
||||
Bit = _mm_add_epi32(Bit, _mm_and_si128(Shilt, i));
|
||||
Mmi = _mm_and_si128(Mmi, One);
|
||||
}
|
||||
return Bit;
|
||||
|
||||
*/
|
||||
|
||||
template <typename genIUType>
|
||||
GLM_FUNC_QUALIFIER int findMSB
|
||||
(
|
||||
genIUType const & Value
|
||||
)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genIUType>::is_integer, "'findMSB' only accept integer values");
|
||||
|
||||
if(Value == genIUType(0) || Value == genIUType(-1))
|
||||
return -1;
|
||||
else if(Value > 0)
|
||||
{
|
||||
genIUType Bit = genIUType(-1);
|
||||
for(genIUType tmp = Value; tmp > 0; tmp >>= 1, ++Bit){}
|
||||
return Bit;
|
||||
}
|
||||
else //if(Value < 0)
|
||||
{
|
||||
int const BitCount(sizeof(genIUType) * 8);
|
||||
int MostSignificantBit(-1);
|
||||
for(int BitIndex(0); BitIndex < BitCount; ++BitIndex)
|
||||
MostSignificantBit = (Value & (1 << BitIndex)) ? MostSignificantBit : BitIndex;
|
||||
assert(MostSignificantBit >= 0);
|
||||
return MostSignificantBit;
|
||||
}
|
||||
}
|
||||
#endif//(GLM_COMPILER)
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER detail::tvec2<int, P> findMSB
|
||||
(
|
||||
detail::tvec2<T, P> const & value
|
||||
)
|
||||
{
|
||||
return detail::tvec2<int, P>(
|
||||
findMSB(value[0]),
|
||||
findMSB(value[1]));
|
||||
return findMSB(tvec1<genIUType>(x)).x;
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER detail::tvec3<int, P> findMSB
|
||||
(
|
||||
detail::tvec3<T, P> const & value
|
||||
)
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<int, P> findMSB(vecType<T, P> const & x)
|
||||
{
|
||||
return detail::tvec3<int, P>(
|
||||
findMSB(value[0]),
|
||||
findMSB(value[1]),
|
||||
findMSB(value[2]));
|
||||
}
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_integer, "'findMSB' only accept integer values");
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER detail::tvec4<int, P> findMSB
|
||||
(
|
||||
detail::tvec4<T, P> const & value
|
||||
)
|
||||
{
|
||||
return detail::tvec4<int, P>(
|
||||
findMSB(value[0]),
|
||||
findMSB(value[1]),
|
||||
findMSB(value[2]),
|
||||
findMSB(value[3]));
|
||||
return detail::compute_findMSB_vec<T, P, vecType, sizeof(T) * 8>::call(x);
|
||||
}
|
||||
}//namespace glm
|
||||
|
||||
@ -12,6 +12,10 @@
|
||||
/// 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
|
||||
@ -21,7 +25,7 @@
|
||||
/// THE SOFTWARE.
|
||||
///
|
||||
/// @ref core
|
||||
/// @file glm/core/func_matrix.hpp
|
||||
/// @file glm/detail/func_matrix.hpp
|
||||
/// @date 2008-08-03 / 2011-06-15
|
||||
/// @author Christophe Riccio
|
||||
///
|
||||
@ -37,8 +41,7 @@
|
||||
/// floating point version is shown.
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef GLM_CORE_func_matrix
|
||||
#define GLM_CORE_func_matrix
|
||||
#pragma once
|
||||
|
||||
// Dependencies
|
||||
#include "../detail/precision.hpp"
|
||||
@ -137,8 +140,6 @@ namespace detail
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/outerProduct.xml">GLSL outerProduct man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.6 Matrix Functions</a>
|
||||
///
|
||||
/// @todo Clarify the declaration to specify that matType doesn't have to be provided when used.
|
||||
template <typename T, precision P, template <typename, precision> class vecTypeA, template <typename, precision> class vecTypeB>
|
||||
GLM_FUNC_DECL typename detail::outerProduct_trait<T, P, vecTypeA, vecTypeB>::type outerProduct(vecTypeA<T, P> const & c, vecTypeB<T, P> const & r);
|
||||
|
||||
@ -148,7 +149,7 @@ namespace detail
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/transpose.xml">GLSL transpose man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.6 Matrix Functions</a>
|
||||
# if((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC11))
|
||||
# if((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2012))
|
||||
template <typename T, precision P, template <typename, precision> class matType>
|
||||
GLM_FUNC_DECL typename matType<T, P>::transpose_type transpose(matType<T, P> const & x);
|
||||
# endif
|
||||
@ -175,5 +176,3 @@ namespace detail
|
||||
}//namespace glm
|
||||
|
||||
#include "func_matrix.inl"
|
||||
|
||||
#endif//GLM_CORE_func_matrix
|
||||
|
||||
@ -12,6 +12,10 @@
|
||||
/// 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
|
||||
@ -21,7 +25,7 @@
|
||||
/// THE SOFTWARE.
|
||||
///
|
||||
/// @ref core
|
||||
/// @file glm/core/func_matrix.inl
|
||||
/// @file glm/detail/func_matrix.inl
|
||||
/// @date 2008-03-08 / 2011-06-15
|
||||
/// @author Christophe Riccio
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
@ -32,173 +36,15 @@
|
||||
namespace glm{
|
||||
namespace detail
|
||||
{
|
||||
template
|
||||
<
|
||||
template <class, precision> class vecTypeA,
|
||||
template <class, precision> class vecTypeB,
|
||||
typename T, precision P
|
||||
>
|
||||
struct compute_outerProduct{};
|
||||
|
||||
template <typename T, precision P>
|
||||
struct compute_outerProduct<detail::tvec2, detail::tvec2, T, P>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static typename detail::outerProduct_trait<T, P, detail::tvec2, detail::tvec2>::type call(detail::tvec2<T, P> const & c, detail::tvec2<T, P> const & r)
|
||||
{
|
||||
detail::tmat2x2<T, P> m(detail::tmat2x2<T, P>::_null);
|
||||
m[0][0] = c[0] * r[0];
|
||||
m[0][1] = c[1] * r[0];
|
||||
m[1][0] = c[0] * r[1];
|
||||
m[1][1] = c[1] * r[1];
|
||||
return m;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T, precision P>
|
||||
struct compute_outerProduct<detail::tvec3, detail::tvec3, T, P>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static typename detail::outerProduct_trait<T, P, detail::tvec3, detail::tvec3>::type call(detail::tvec3<T, P> const & c, detail::tvec3<T, P> const & r)
|
||||
{
|
||||
detail::tmat3x3<T, P> m(detail::tmat3x3<T, P>::_null);
|
||||
for(length_t i(0); i < m.length(); ++i)
|
||||
m[i] = c * r[i];
|
||||
return m;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T, precision P>
|
||||
struct compute_outerProduct<detail::tvec4, detail::tvec4, T, P>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static typename detail::outerProduct_trait<T, P, detail::tvec4, detail::tvec4>::type call(detail::tvec4<T, P> const & c, detail::tvec4<T, P> const & r)
|
||||
{
|
||||
detail::tmat4x4<T, P> m(detail::tmat4x4<T, P>::_null);
|
||||
for(length_t i(0); i < m.length(); ++i)
|
||||
m[i] = c * r[i];
|
||||
return m;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T, precision P>
|
||||
struct compute_outerProduct<detail::tvec3, detail::tvec2, T, P>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static typename detail::outerProduct_trait<T, P, detail::tvec3, detail::tvec2>::type call(detail::tvec3<T, P> const & c, detail::tvec2<T, P> const & r)
|
||||
{
|
||||
detail::tmat2x3<T, P> m(detail::tmat2x3<T, P>::_null);
|
||||
m[0][0] = c.x * r.x;
|
||||
m[0][1] = c.y * r.x;
|
||||
m[0][2] = c.z * r.x;
|
||||
m[1][0] = c.x * r.y;
|
||||
m[1][1] = c.y * r.y;
|
||||
m[1][2] = c.z * r.y;
|
||||
return m;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T, precision P>
|
||||
struct compute_outerProduct<detail::tvec2, detail::tvec3, T, P>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static typename detail::outerProduct_trait<T, P, detail::tvec2, detail::tvec3>::type call(detail::tvec2<T, P> const & c, detail::tvec3<T, P> const & r)
|
||||
{
|
||||
detail::tmat3x2<T, P> m(detail::tmat3x2<T, P>::_null);
|
||||
m[0][0] = c.x * r.x;
|
||||
m[0][1] = c.y * r.x;
|
||||
m[1][0] = c.x * r.y;
|
||||
m[1][1] = c.y * r.y;
|
||||
m[2][0] = c.x * r.z;
|
||||
m[2][1] = c.y * r.z;
|
||||
return m;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T, precision P>
|
||||
struct compute_outerProduct<detail::tvec4, detail::tvec2, T, P>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static typename detail::outerProduct_trait<T, P, detail::tvec4, detail::tvec2>::type call(detail::tvec4<T, P> const & c, detail::tvec2<T, P> const & r)
|
||||
{
|
||||
detail::tmat2x4<T, P> m(detail::tmat2x4<T, P>::_null);
|
||||
m[0][0] = c.x * r.x;
|
||||
m[0][1] = c.y * r.x;
|
||||
m[0][2] = c.z * r.x;
|
||||
m[0][3] = c.w * r.x;
|
||||
m[1][0] = c.x * r.y;
|
||||
m[1][1] = c.y * r.y;
|
||||
m[1][2] = c.z * r.y;
|
||||
m[1][3] = c.w * r.y;
|
||||
return m;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T, precision P>
|
||||
struct compute_outerProduct<detail::tvec2, detail::tvec4, T, P>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static typename detail::outerProduct_trait<T, P, detail::tvec2, detail::tvec4>::type call(detail::tvec2<T, P> const & c, detail::tvec4<T, P> const & r)
|
||||
{
|
||||
detail::tmat4x2<T, P> m(detail::tmat4x2<T, P>::_null);
|
||||
m[0][0] = c.x * r.x;
|
||||
m[0][1] = c.y * r.x;
|
||||
m[1][0] = c.x * r.y;
|
||||
m[1][1] = c.y * r.y;
|
||||
m[2][0] = c.x * r.z;
|
||||
m[2][1] = c.y * r.z;
|
||||
m[3][0] = c.x * r.w;
|
||||
m[3][1] = c.y * r.w;
|
||||
return m;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T, precision P>
|
||||
struct compute_outerProduct<detail::tvec4, detail::tvec3, T, P>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static typename detail::outerProduct_trait<T, P, detail::tvec4, detail::tvec3>::type call(detail::tvec4<T, P> const & c, detail::tvec3<T, P> const & r)
|
||||
{
|
||||
detail::tmat3x4<T, P> m(detail::tmat3x4<T, P>::_null);
|
||||
m[0][0] = c.x * r.x;
|
||||
m[0][1] = c.y * r.x;
|
||||
m[0][2] = c.z * r.x;
|
||||
m[0][3] = c.w * r.x;
|
||||
m[1][0] = c.x * r.y;
|
||||
m[1][1] = c.y * r.y;
|
||||
m[1][2] = c.z * r.y;
|
||||
m[1][3] = c.w * r.y;
|
||||
m[2][0] = c.x * r.z;
|
||||
m[2][1] = c.y * r.z;
|
||||
m[2][2] = c.z * r.z;
|
||||
m[2][3] = c.w * r.z;
|
||||
return m;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T, precision P>
|
||||
struct compute_outerProduct<detail::tvec3, detail::tvec4, T, P>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static typename detail::outerProduct_trait<T, P, detail::tvec3, detail::tvec4>::type call(detail::tvec3<T, P> const & c, detail::tvec4<T, P> const & r)
|
||||
{
|
||||
detail::tmat4x3<T, P> m(detail::tmat4x3<T, P>::_null);
|
||||
m[0][0] = c.x * r.x;
|
||||
m[0][1] = c.y * r.x;
|
||||
m[0][2] = c.z * r.x;
|
||||
m[1][0] = c.x * r.y;
|
||||
m[1][1] = c.y * r.y;
|
||||
m[1][2] = c.z * r.y;
|
||||
m[2][0] = c.x * r.z;
|
||||
m[2][1] = c.y * r.z;
|
||||
m[2][2] = c.z * r.z;
|
||||
m[3][0] = c.x * r.w;
|
||||
m[3][1] = c.y * r.w;
|
||||
m[3][2] = c.z * r.w;
|
||||
return m;
|
||||
}
|
||||
};
|
||||
|
||||
template <template <class, precision> class matType, typename T, precision P>
|
||||
struct compute_transpose{};
|
||||
|
||||
template <typename T, precision P>
|
||||
struct compute_transpose<detail::tmat2x2, T, P>
|
||||
struct compute_transpose<tmat2x2, T, P>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static detail::tmat2x2<T, P> call(detail::tmat2x2<T, P> const & m)
|
||||
GLM_FUNC_QUALIFIER static tmat2x2<T, P> call(tmat2x2<T, P> const & m)
|
||||
{
|
||||
detail::tmat2x2<T, P> result(detail::tmat2x2<T, P>::_null);
|
||||
tmat2x2<T, P> result(uninitialize);
|
||||
result[0][0] = m[0][0];
|
||||
result[0][1] = m[1][0];
|
||||
result[1][0] = m[0][1];
|
||||
@ -208,11 +54,11 @@ namespace detail
|
||||
};
|
||||
|
||||
template <typename T, precision P>
|
||||
struct compute_transpose<detail::tmat2x3, T, P>
|
||||
struct compute_transpose<tmat2x3, T, P>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static detail::tmat3x2<T, P> call(detail::tmat2x3<T, P> const & m)
|
||||
GLM_FUNC_QUALIFIER static tmat3x2<T, P> call(tmat2x3<T, P> const & m)
|
||||
{
|
||||
detail::tmat3x2<T, P> result(detail::tmat3x2<T, P>::_null);
|
||||
tmat3x2<T, P> result(uninitialize);
|
||||
result[0][0] = m[0][0];
|
||||
result[0][1] = m[1][0];
|
||||
result[1][0] = m[0][1];
|
||||
@ -224,11 +70,11 @@ namespace detail
|
||||
};
|
||||
|
||||
template <typename T, precision P>
|
||||
struct compute_transpose<detail::tmat2x4, T, P>
|
||||
struct compute_transpose<tmat2x4, T, P>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static detail::tmat4x2<T, P> call(detail::tmat2x4<T, P> const & m)
|
||||
GLM_FUNC_QUALIFIER static tmat4x2<T, P> call(tmat2x4<T, P> const & m)
|
||||
{
|
||||
detail::tmat4x2<T, P> result(detail::tmat4x2<T, P>::_null);
|
||||
tmat4x2<T, P> result(uninitialize);
|
||||
result[0][0] = m[0][0];
|
||||
result[0][1] = m[1][0];
|
||||
result[1][0] = m[0][1];
|
||||
@ -242,11 +88,11 @@ namespace detail
|
||||
};
|
||||
|
||||
template <typename T, precision P>
|
||||
struct compute_transpose<detail::tmat3x2, T, P>
|
||||
struct compute_transpose<tmat3x2, T, P>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static detail::tmat2x3<T, P> call(detail::tmat3x2<T, P> const & m)
|
||||
GLM_FUNC_QUALIFIER static tmat2x3<T, P> call(tmat3x2<T, P> const & m)
|
||||
{
|
||||
detail::tmat2x3<T, P> result(detail::tmat2x3<T, P>::_null);
|
||||
tmat2x3<T, P> result(uninitialize);
|
||||
result[0][0] = m[0][0];
|
||||
result[0][1] = m[1][0];
|
||||
result[0][2] = m[2][0];
|
||||
@ -258,11 +104,11 @@ namespace detail
|
||||
};
|
||||
|
||||
template <typename T, precision P>
|
||||
struct compute_transpose<detail::tmat3x3, T, P>
|
||||
struct compute_transpose<tmat3x3, T, P>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static detail::tmat3x3<T, P> call(detail::tmat3x3<T, P> const & m)
|
||||
GLM_FUNC_QUALIFIER static tmat3x3<T, P> call(tmat3x3<T, P> const & m)
|
||||
{
|
||||
detail::tmat3x3<T, P> result(detail::tmat3x3<T, P>::_null);
|
||||
tmat3x3<T, P> result(uninitialize);
|
||||
result[0][0] = m[0][0];
|
||||
result[0][1] = m[1][0];
|
||||
result[0][2] = m[2][0];
|
||||
@ -279,11 +125,11 @@ namespace detail
|
||||
};
|
||||
|
||||
template <typename T, precision P>
|
||||
struct compute_transpose<detail::tmat3x4, T, P>
|
||||
struct compute_transpose<tmat3x4, T, P>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static detail::tmat4x3<T, P> call(detail::tmat3x4<T, P> const & m)
|
||||
GLM_FUNC_QUALIFIER static tmat4x3<T, P> call(tmat3x4<T, P> const & m)
|
||||
{
|
||||
detail::tmat4x3<T, P> result(detail::tmat4x3<T, P>::_null);
|
||||
tmat4x3<T, P> result(uninitialize);
|
||||
result[0][0] = m[0][0];
|
||||
result[0][1] = m[1][0];
|
||||
result[0][2] = m[2][0];
|
||||
@ -301,11 +147,11 @@ namespace detail
|
||||
};
|
||||
|
||||
template <typename T, precision P>
|
||||
struct compute_transpose<detail::tmat4x2, T, P>
|
||||
struct compute_transpose<tmat4x2, T, P>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static detail::tmat2x4<T, P> call(detail::tmat4x2<T, P> const & m)
|
||||
GLM_FUNC_QUALIFIER static tmat2x4<T, P> call(tmat4x2<T, P> const & m)
|
||||
{
|
||||
detail::tmat2x4<T, P> result(detail::tmat2x4<T, P>::_null);
|
||||
tmat2x4<T, P> result(uninitialize);
|
||||
result[0][0] = m[0][0];
|
||||
result[0][1] = m[1][0];
|
||||
result[0][2] = m[2][0];
|
||||
@ -319,11 +165,11 @@ namespace detail
|
||||
};
|
||||
|
||||
template <typename T, precision P>
|
||||
struct compute_transpose<detail::tmat4x3, T, P>
|
||||
struct compute_transpose<tmat4x3, T, P>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static detail::tmat3x4<T, P> call(detail::tmat4x3<T, P> const & m)
|
||||
GLM_FUNC_QUALIFIER static tmat3x4<T, P> call(tmat4x3<T, P> const & m)
|
||||
{
|
||||
detail::tmat3x4<T, P> result(detail::tmat3x4<T, P>::_null);
|
||||
tmat3x4<T, P> result(uninitialize);
|
||||
result[0][0] = m[0][0];
|
||||
result[0][1] = m[1][0];
|
||||
result[0][2] = m[2][0];
|
||||
@ -341,11 +187,11 @@ namespace detail
|
||||
};
|
||||
|
||||
template <typename T, precision P>
|
||||
struct compute_transpose<detail::tmat4x4, T, P>
|
||||
struct compute_transpose<tmat4x4, T, P>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static detail::tmat4x4<T, P> call(detail::tmat4x4<T, P> const & m)
|
||||
GLM_FUNC_QUALIFIER static tmat4x4<T, P> call(tmat4x4<T, P> const & m)
|
||||
{
|
||||
detail::tmat4x4<T, P> result(detail::tmat4x4<T, P>::_null);
|
||||
tmat4x4<T, P> result(uninitialize);
|
||||
result[0][0] = m[0][0];
|
||||
result[0][1] = m[1][0];
|
||||
result[0][2] = m[2][0];
|
||||
@ -373,18 +219,18 @@ namespace detail
|
||||
struct compute_determinant{};
|
||||
|
||||
template <typename T, precision P>
|
||||
struct compute_determinant<detail::tmat2x2, T, P>
|
||||
struct compute_determinant<tmat2x2, T, P>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static T call(detail::tmat2x2<T, P> const & m)
|
||||
GLM_FUNC_QUALIFIER static T call(tmat2x2<T, P> const & m)
|
||||
{
|
||||
return m[0][0] * m[1][1] - m[1][0] * m[0][1];
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T, precision P>
|
||||
struct compute_determinant<detail::tmat3x3, T, P>
|
||||
struct compute_determinant<tmat3x3, T, P>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static T call(detail::tmat3x3<T, P> const & m)
|
||||
GLM_FUNC_QUALIFIER static T call(tmat3x3<T, P> const & m)
|
||||
{
|
||||
return
|
||||
+ m[0][0] * (m[1][1] * m[2][2] - m[2][1] * m[1][2])
|
||||
@ -394,9 +240,9 @@ namespace detail
|
||||
};
|
||||
|
||||
template <typename T, precision P>
|
||||
struct compute_determinant<detail::tmat4x4, T, P>
|
||||
struct compute_determinant<tmat4x4, T, P>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static T call(detail::tmat4x4<T, P> const & m)
|
||||
GLM_FUNC_QUALIFIER static T call(tmat4x4<T, P> const & m)
|
||||
{
|
||||
T SubFactor00 = m[2][2] * m[3][3] - m[3][2] * m[2][3];
|
||||
T SubFactor01 = m[2][1] * m[3][3] - m[3][1] * m[2][3];
|
||||
@ -405,7 +251,7 @@ namespace detail
|
||||
T SubFactor04 = m[2][0] * m[3][2] - m[3][0] * m[2][2];
|
||||
T SubFactor05 = m[2][0] * m[3][1] - m[3][0] * m[2][1];
|
||||
|
||||
detail::tvec4<T, P> DetCof(
|
||||
tvec4<T, P> DetCof(
|
||||
+ (m[1][1] * SubFactor00 - m[1][2] * SubFactor01 + m[1][3] * SubFactor02),
|
||||
- (m[1][0] * SubFactor00 - m[1][2] * SubFactor03 + m[1][3] * SubFactor04),
|
||||
+ (m[1][0] * SubFactor01 - m[1][1] * SubFactor03 + m[1][3] * SubFactor05),
|
||||
@ -423,8 +269,8 @@ namespace detail
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'matrixCompMult' only accept floating-point inputs");
|
||||
|
||||
matType<T, P> result(matType<T, P>::_null);
|
||||
for(length_t i = 0; i < result.length(); ++i)
|
||||
matType<T, P> result(uninitialize);
|
||||
for(detail::component_count_t i = 0; i < detail::component_count(result); ++i)
|
||||
result[i] = x[i] * y[i];
|
||||
return result;
|
||||
}
|
||||
@ -433,7 +279,11 @@ namespace detail
|
||||
GLM_FUNC_QUALIFIER typename detail::outerProduct_trait<T, P, vecTypeA, vecTypeB>::type outerProduct(vecTypeA<T, P> const & c, vecTypeB<T, P> const & r)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'outerProduct' only accept floating-point inputs");
|
||||
return detail::compute_outerProduct<vecTypeA, vecTypeB, T, P>::call(c, r);
|
||||
|
||||
typename detail::outerProduct_trait<T, P, vecTypeA, vecTypeB>::type m(uninitialize);
|
||||
for(detail::component_count_t i = 0; i < detail::component_count(m); ++i)
|
||||
m[i] = c * r[i];
|
||||
return m;
|
||||
}
|
||||
|
||||
template <typename T, precision P, template <typename, precision> class matType>
|
||||
@ -454,7 +304,7 @@ namespace detail
|
||||
GLM_FUNC_QUALIFIER matType<T, P> inverse(matType<T, P> const & m)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'inverse' only accept floating-point inputs");
|
||||
return detail::compute_inverse<matType, T, P>::call(m);
|
||||
return detail::compute_inverse(m);
|
||||
}
|
||||
|
||||
}//namespace glm
|
||||
|
||||
@ -12,6 +12,10 @@
|
||||
/// 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
|
||||
@ -21,7 +25,7 @@
|
||||
/// THE SOFTWARE.
|
||||
///
|
||||
/// @ref core
|
||||
/// @file glm/core/func_noise.hpp
|
||||
/// @file glm/detail/func_noise.hpp
|
||||
/// @date 2008-08-01 / 2011-06-18
|
||||
/// @author Christophe Riccio
|
||||
///
|
||||
@ -35,8 +39,7 @@
|
||||
/// appearance of randomness, but are not truly random.
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef glm_core_func_noise
|
||||
#define glm_core_func_noise
|
||||
#pragma once
|
||||
|
||||
#include "type_vec1.hpp"
|
||||
#include "type_vec2.hpp"
|
||||
@ -64,7 +67,7 @@ namespace glm
|
||||
/// @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 detail::tvec2<typename genType::value_type, defaultp> noise2(genType const & x);
|
||||
GLM_FUNC_DECL tvec2<typename genType::value_type, defaultp> noise2(genType const & x);
|
||||
|
||||
/// Returns a 3D noise value based on the input value x.
|
||||
///
|
||||
@ -73,7 +76,7 @@ namespace glm
|
||||
/// @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 detail::tvec3<typename genType::value_type, defaultp> noise3(genType const & x);
|
||||
GLM_FUNC_DECL tvec3<typename genType::value_type, defaultp> noise3(genType const & x);
|
||||
|
||||
/// Returns a 4D noise value based on the input value x.
|
||||
///
|
||||
@ -82,11 +85,9 @@ namespace glm
|
||||
/// @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 detail::tvec4<typename genType::value_type, defaultp> noise4(genType const & x);
|
||||
GLM_FUNC_DECL tvec4<typename genType::value_type, defaultp> noise4(genType const & x);
|
||||
|
||||
/// @}
|
||||
}//namespace glm
|
||||
|
||||
#include "func_noise.inl"
|
||||
|
||||
#endif//glm_core_func_noise
|
||||
|
||||
@ -12,6 +12,10 @@
|
||||
/// 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
|
||||
@ -21,7 +25,7 @@
|
||||
/// THE SOFTWARE.
|
||||
///
|
||||
/// @ref core
|
||||
/// @file glm/core/func_noise.inl
|
||||
/// @file glm/detail/func_noise.inl
|
||||
/// @date 2008-08-01 / 2011-09-27
|
||||
/// @author Christophe Riccio
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
@ -33,43 +37,43 @@ namespace glm{
|
||||
namespace detail
|
||||
{
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER detail::tvec4<T, P> grad4(T const & j, detail::tvec4<T, P> const & ip)
|
||||
GLM_FUNC_QUALIFIER tvec4<T, P> grad4(T const & j, tvec4<T, P> const & ip)
|
||||
{
|
||||
detail::tvec3<T, P> pXYZ = floor(fract(detail::tvec3<T, P>(j) * detail::tvec3<T, P>(ip)) * T(7)) * ip[2] - T(1);
|
||||
T pW = static_cast<T>(1.5) - dot(abs(pXYZ), detail::tvec3<T, P>(1));
|
||||
detail::tvec4<T, P> s = detail::tvec4<T, P>(lessThan(detail::tvec4<T, P>(pXYZ, pW), detail::tvec4<T, P>(0.0)));
|
||||
pXYZ = pXYZ + (detail::tvec3<T, P>(s) * T(2) - T(1)) * s.w;
|
||||
return detail::tvec4<T, P>(pXYZ, pW);
|
||||
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(detail::tvec2<T, defaultp>(x, T(0)));
|
||||
return noise1(tvec2<T, defaultp>(x, T(0)));
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
GLM_FUNC_QUALIFIER detail::tvec2<T, defaultp> noise2(T const & x)
|
||||
GLM_FUNC_QUALIFIER tvec2<T, defaultp> noise2(T const & x)
|
||||
{
|
||||
return detail::tvec2<T, defaultp>(
|
||||
return tvec2<T, defaultp>(
|
||||
noise1(x + T(0.0)),
|
||||
noise1(x + T(1.0)));
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
GLM_FUNC_QUALIFIER detail::tvec3<T, defaultp> noise3(T const & x)
|
||||
GLM_FUNC_QUALIFIER tvec3<T, defaultp> noise3(T const & x)
|
||||
{
|
||||
return detail::tvec3<T, defaultp>(
|
||||
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 detail::tvec4<T, defaultp> noise4(T const & x)
|
||||
GLM_FUNC_QUALIFIER tvec4<T, defaultp> noise4(T const & x)
|
||||
{
|
||||
return detail::tvec4<T, defaultp>(
|
||||
return tvec4<T, defaultp>(
|
||||
noise1(x - T(1.0)),
|
||||
noise1(x + T(0.0)),
|
||||
noise1(x + T(1.0)),
|
||||
@ -77,38 +81,38 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER T noise1(detail::tvec2<T, P> const & v)
|
||||
GLM_FUNC_QUALIFIER T noise1(tvec2<T, P> const & v)
|
||||
{
|
||||
detail::tvec4<T, P> const C = detail::tvec4<T, P>(
|
||||
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
|
||||
detail::tvec2<T, P> i = floor(v + dot(v, detail::tvec2<T, P>(C[1])));
|
||||
detail::tvec2<T, P> x0 = v - i + dot(i, detail::tvec2<T, P>(C[0]));
|
||||
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;
|
||||
detail::tvec2<T, P> i1 = (x0.x > x0.y) ? detail::tvec2<T, P>(1, 0) : detail::tvec2<T, P>(0, 1);
|
||||
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 ;
|
||||
detail::tvec4<T, P> x12 = detail::tvec4<T, P>(x0.x, x0.y, x0.x, x0.y) + detail::tvec4<T, P>(C.x, C.x, C.z, C.z);
|
||||
x12 = detail::tvec4<T, P>(detail::tvec2<T, P>(x12) - i1, x12.z, x12.w);
|
||||
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
|
||||
detail::tvec3<T, P> p = detail::permute(
|
||||
detail::permute(i.y + detail::tvec3<T, P>(T(0), i1.y, T(1))) + i.x + detail::tvec3<T, P>(T(0), i1.x, T(1)));
|
||||
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)));
|
||||
|
||||
detail::tvec3<T, P> m = max(T(0.5) - detail::tvec3<T, P>(
|
||||
tvec3<T, P> m = max(T(0.5) - tvec3<T, P>(
|
||||
dot(x0, x0),
|
||||
dot(detail::tvec2<T, P>(x12.x, x12.y), detail::tvec2<T, P>(x12.x, x12.y)),
|
||||
dot(detail::tvec2<T, P>(x12.z, x12.w), detail::tvec2<T, P>(x12.z, x12.w))), T(0));
|
||||
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;
|
||||
@ -116,17 +120,17 @@ namespace detail
|
||||
// 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)
|
||||
|
||||
detail::tvec3<T, P> x = static_cast<T>(2) * fract(p * C.w) - T(1);
|
||||
detail::tvec3<T, P> h = abs(x) - T(0.5);
|
||||
detail::tvec3<T, P> ox = floor(x + T(0.5));
|
||||
detail::tvec3<T, P> a0 = x - ox;
|
||||
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
|
||||
detail::tvec3<T, P> g;
|
||||
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;
|
||||
@ -135,84 +139,84 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER T noise1(detail::tvec3<T, P> const & v)
|
||||
GLM_FUNC_QUALIFIER T noise1(tvec3<T, P> const & v)
|
||||
{
|
||||
detail::tvec2<T, P> const C(1.0 / 6.0, 1.0 / 3.0);
|
||||
detail::tvec4<T, P> const D(0.0, 0.5, 1.0, 2.0);
|
||||
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
|
||||
detail::tvec3<T, P> i(floor(v + dot(v, detail::tvec3<T, P>(C.y))));
|
||||
detail::tvec3<T, P> x0(v - i + dot(i, detail::tvec3<T, P>(C.x)));
|
||||
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
|
||||
detail::tvec3<T, P> g(step(detail::tvec3<T, P>(x0.y, x0.z, x0.x), x0));
|
||||
detail::tvec3<T, P> l(T(1) - g);
|
||||
detail::tvec3<T, P> i1(min(g, detail::tvec3<T, P>(l.z, l.x, l.y)));
|
||||
detail::tvec3<T, P> i2(max(g, detail::tvec3<T, P>(l.z, l.x, l.y)));
|
||||
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;
|
||||
detail::tvec3<T, P> x1(x0 - i1 + C.x);
|
||||
detail::tvec3<T, P> x2(x0 - i2 + C.y); // 2.0*C.x = 1/3 = C.y
|
||||
detail::tvec3<T, P> x3(x0 - D.y); // -1.0+3.0*C.x = -0.5 = -D.y
|
||||
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);
|
||||
detail::tvec4<T, P> p(detail::permute(detail::permute(detail::permute(
|
||||
i.z + detail::tvec4<T, P>(T(0), i1.z, i2.z, T(1))) +
|
||||
i.y + detail::tvec4<T, P>(T(0), i1.y, i2.y, T(1))) +
|
||||
i.x + detail::tvec4<T, P>(T(0), i1.x, i2.x, T(1))));
|
||||
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
|
||||
detail::tvec3<T, P> ns(n_ * detail::tvec3<T, P>(D.w, D.y, D.z) - detail::tvec3<T, P>(D.x, D.z, D.x));
|
||||
tvec3<T, P> ns(n_ * tvec3<T, P>(D.w, D.y, D.z) - tvec3<T, P>(D.x, D.z, D.x));
|
||||
|
||||
detail::tvec4<T, P> j(p - T(49) * floor(p * ns.z * ns.z)); // mod(p,7*7)
|
||||
tvec4<T, P> j(p - T(49) * floor(p * ns.z * ns.z)); // mod(p,7*7)
|
||||
|
||||
detail::tvec4<T, P> x_(floor(j * ns.z));
|
||||
detail::tvec4<T, P> y_(floor(j - T(7) * x_)); // mod(j,N)
|
||||
tvec4<T, P> x_(floor(j * ns.z));
|
||||
tvec4<T, P> y_(floor(j - T(7) * x_)); // mod(j,N)
|
||||
|
||||
detail::tvec4<T, P> x(x_ * ns.x + ns.y);
|
||||
detail::tvec4<T, P> y(y_ * ns.x + ns.y);
|
||||
detail::tvec4<T, P> h(T(1) - abs(x) - abs(y));
|
||||
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));
|
||||
|
||||
detail::tvec4<T, P> b0(x.x, x.y, y.x, y.y);
|
||||
detail::tvec4<T, P> b1(x.z, x.w, y.z, y.w);
|
||||
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;
|
||||
detail::tvec4<T, P> s0(floor(b0) * T(2) + T(1));
|
||||
detail::tvec4<T, P> s1(floor(b1) * T(2) + T(1));
|
||||
detail::tvec4<T, P> sh(-step(h, detail::tvec4<T, P>(0.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)));
|
||||
|
||||
detail::tvec4<T, P> a0 = detail::tvec4<T, P>(b0.x, b0.z, b0.y, b0.w) + detail::tvec4<T, P>(s0.x, s0.z, s0.y, s0.w) * detail::tvec4<T, P>(sh.x, sh.x, sh.y, sh.y);
|
||||
detail::tvec4<T, P> a1 = detail::tvec4<T, P>(b1.x, b1.z, b1.y, b1.w) + detail::tvec4<T, P>(s1.x, s1.z, s1.y, s1.w) * detail::tvec4<T, P>(sh.z, sh.z, sh.w, sh.w);
|
||||
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);
|
||||
|
||||
detail::tvec3<T, P> p0(a0.x, a0.y, h.x);
|
||||
detail::tvec3<T, P> p1(a0.z, a0.w, h.y);
|
||||
detail::tvec3<T, P> p2(a1.x, a1.y, h.z);
|
||||
detail::tvec3<T, P> p3(a1.z, a1.w, h.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
|
||||
detail::tvec4<T, P> norm = taylorInvSqrt(detail::tvec4<T, P>(dot(p0, p0), dot(p1, p1), dot(p2, p2), dot(p3, p3)));
|
||||
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
|
||||
detail::tvec4<T, P> m = max(T(0.6) - detail::tvec4<T, P>(dot(x0, x0), dot(x1, x1), dot(x2, x2), dot(x3, x3)), T(0));
|
||||
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, detail::tvec4<T, P>(dot(p0, x0), dot(p1, x1), dot(p2, x2), dot(p3, x3)));
|
||||
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(detail::tvec4<T, P> const & v)
|
||||
GLM_FUNC_QUALIFIER T noise1(tvec4<T, P> const & v)
|
||||
{
|
||||
detail::tvec4<T, P> const C(
|
||||
tvec4<T, P> const C(
|
||||
0.138196601125011, // (5 - sqrt(5))/20 G4
|
||||
0.276393202250021, // 2 * G4
|
||||
0.414589803375032, // 3 * G4
|
||||
@ -222,66 +226,66 @@ namespace detail
|
||||
T const F4 = static_cast<T>(0.309016994374947451);
|
||||
|
||||
// First corner
|
||||
detail::tvec4<T, P> i = floor(v + dot(v, detail::tvec4<T, P>(F4)));
|
||||
detail::tvec4<T, P> x0 = v - i + dot(i, detail::tvec4<T, P>(C.x));
|
||||
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)
|
||||
detail::tvec4<T, P> i0;
|
||||
detail::tvec3<T, P> isX = step(detail::tvec3<T, P>(x0.y, x0.z, x0.w), detail::tvec3<T, P>(x0.x));
|
||||
detail::tvec3<T, P> isYZ = step(detail::tvec3<T, P>(x0.z, x0.w, x0.w), detail::tvec3<T, P>(x0.y, x0.y, x0.z));
|
||||
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 = detail::tvec4<T, P>(isX.x + isX.y + isX.z, 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 - detail::tvec2<T, P>(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
|
||||
detail::tvec4<T, P> i3 = clamp(i0, T(0), T(1));
|
||||
detail::tvec4<T, P> i2 = clamp(i0 - T(1), T(0), T(1));
|
||||
detail::tvec4<T, P> i1 = clamp(i0 - T(2), T(0), T(1));
|
||||
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
|
||||
detail::tvec4<T, P> x1 = x0 - i1 + C.x;
|
||||
detail::tvec4<T, P> x2 = x0 - i2 + C.y;
|
||||
detail::tvec4<T, P> x3 = x0 - i3 + C.z;
|
||||
detail::tvec4<T, P> x4 = x0 + C.w;
|
||||
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);
|
||||
detail::tvec4<T, P> j1 = detail::permute(detail::permute(detail::permute(detail::permute(
|
||||
i.w + detail::tvec4<T, P>(i1.w, i2.w, i3.w, T(1))) +
|
||||
i.z + detail::tvec4<T, P>(i1.z, i2.z, i3.z, T(1))) +
|
||||
i.y + detail::tvec4<T, P>(i1.y, i2.y, i3.y, T(1))) +
|
||||
i.x + detail::tvec4<T, P>(i1.x, i2.x, i3.x, T(1)));
|
||||
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.
|
||||
detail::tvec4<T, P> ip = detail::tvec4<T, P>(T(1) / T(294), T(1) / T(49), T(1) / T(7), T(0));
|
||||
tvec4<T, P> ip = tvec4<T, P>(T(1) / T(294), T(1) / T(49), T(1) / T(7), T(0));
|
||||
|
||||
detail::tvec4<T, P> p0 = detail::grad4(j0, ip);
|
||||
detail::tvec4<T, P> p1 = detail::grad4(j1.x, ip);
|
||||
detail::tvec4<T, P> p2 = detail::grad4(j1.y, ip);
|
||||
detail::tvec4<T, P> p3 = detail::grad4(j1.z, ip);
|
||||
detail::tvec4<T, P> p4 = detail::grad4(j1.w, ip);
|
||||
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
|
||||
detail::tvec4<T, P> norm = detail::taylorInvSqrt(detail::tvec4<T, P>(dot(p0, p0), dot(p1, p1), dot(p2, p2), dot(p3, p3)));
|
||||
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;
|
||||
@ -289,96 +293,96 @@ namespace detail
|
||||
p4 *= taylorInvSqrt(dot(p4, p4));
|
||||
|
||||
// Mix contributions from the five corners
|
||||
detail::tvec3<T, P> m0 = max(T(0.6) - detail::tvec3<T, P>(dot(x0, x0), dot(x1, x1), dot(x2, x2)), T(0));
|
||||
detail::tvec2<T, P> m1 = max(T(0.6) - detail::tvec2<T, P>(dot(x3, x3), dot(x4, x4) ), T(0));
|
||||
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, detail::tvec3<T, P>(dot(p0, x0), dot(p1, x1), dot(p2, x2))) +
|
||||
dot(m1 * m1, detail::tvec2<T, P>(dot(p3, x3), dot(p4, x4))));
|
||||
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 detail::tvec2<T, P> noise2(detail::tvec2<T, P> const & x)
|
||||
GLM_FUNC_QUALIFIER tvec2<T, P> noise2(tvec2<T, P> const & x)
|
||||
{
|
||||
return detail::tvec2<T, P>(
|
||||
noise1(x + detail::tvec2<T, P>(0.0)),
|
||||
noise1(detail::tvec2<T, P>(0.0) - 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 detail::tvec2<T, P> noise2(detail::tvec3<T, P> const & x)
|
||||
GLM_FUNC_QUALIFIER tvec2<T, P> noise2(tvec3<T, P> const & x)
|
||||
{
|
||||
return detail::tvec2<T, P>(
|
||||
noise1(x + detail::tvec3<T, P>(0.0)),
|
||||
noise1(detail::tvec3<T, P>(0.0) - 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 detail::tvec2<T, P> noise2(detail::tvec4<T, P> const & x)
|
||||
GLM_FUNC_QUALIFIER tvec2<T, P> noise2(tvec4<T, P> const & x)
|
||||
{
|
||||
return detail::tvec2<T, P>(
|
||||
noise1(x + detail::tvec4<T, P>(0)),
|
||||
noise1(detail::tvec4<T, P>(0) - 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 detail::tvec3<T, P> noise3(detail::tvec2<T, P> const & x)
|
||||
GLM_FUNC_QUALIFIER tvec3<T, P> noise3(tvec2<T, P> const & x)
|
||||
{
|
||||
return detail::tvec3<T, P>(
|
||||
noise1(x - detail::tvec2<T, P>(1.0)),
|
||||
noise1(x + detail::tvec2<T, P>(0.0)),
|
||||
noise1(x + detail::tvec2<T, P>(1.0)));
|
||||
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 detail::tvec3<T, P> noise3(detail::tvec3<T, P> const & x)
|
||||
GLM_FUNC_QUALIFIER tvec3<T, P> noise3(tvec3<T, P> const & x)
|
||||
{
|
||||
return detail::tvec3<T, P>(
|
||||
noise1(x - detail::tvec3<T, P>(1.0)),
|
||||
noise1(x + detail::tvec3<T, P>(0.0)),
|
||||
noise1(x + detail::tvec3<T, P>(1.0)));
|
||||
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 detail::tvec3<T, P> noise3(detail::tvec4<T, P> const & x)
|
||||
GLM_FUNC_QUALIFIER tvec3<T, P> noise3(tvec4<T, P> const & x)
|
||||
{
|
||||
return detail::tvec3<T, P>(
|
||||
noise1(x - detail::tvec4<T, P>(1)),
|
||||
noise1(x + detail::tvec4<T, P>(0)),
|
||||
noise1(x + detail::tvec4<T, P>(1)));
|
||||
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 detail::tvec4<T, P> noise4(detail::tvec2<T, P> const & x)
|
||||
GLM_FUNC_QUALIFIER tvec4<T, P> noise4(tvec2<T, P> const & x)
|
||||
{
|
||||
return detail::tvec4<T, P>(
|
||||
noise1(x - detail::tvec2<T, P>(1)),
|
||||
noise1(x + detail::tvec2<T, P>(0)),
|
||||
noise1(x + detail::tvec2<T, P>(1)),
|
||||
noise1(x + detail::tvec2<T, P>(2)));
|
||||
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 detail::tvec4<T, P> noise4(detail::tvec3<T, P> const & x)
|
||||
GLM_FUNC_QUALIFIER tvec4<T, P> noise4(tvec3<T, P> const & x)
|
||||
{
|
||||
return detail::tvec4<T, P>(
|
||||
noise1(x - detail::tvec3<T, P>(1)),
|
||||
noise1(x + detail::tvec3<T, P>(0)),
|
||||
noise1(x + detail::tvec3<T, P>(1)),
|
||||
noise1(x + detail::tvec3<T, P>(2)));
|
||||
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 detail::tvec4<T, P> noise4(detail::tvec4<T, P> const & x)
|
||||
GLM_FUNC_QUALIFIER tvec4<T, P> noise4(tvec4<T, P> const & x)
|
||||
{
|
||||
return detail::tvec4<T, P>(
|
||||
noise1(x - detail::tvec4<T, P>(1)),
|
||||
noise1(x + detail::tvec4<T, P>(0)),
|
||||
noise1(x + detail::tvec4<T, P>(1)),
|
||||
noise1(x + detail::tvec4<T, P>(2)));
|
||||
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
|
||||
|
||||
@ -12,6 +12,10 @@
|
||||
/// 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
|
||||
@ -21,11 +25,12 @@
|
||||
/// THE SOFTWARE.
|
||||
///
|
||||
/// @ref core
|
||||
/// @file glm/core/func_packing.hpp
|
||||
/// @file glm/detail/func_packing.hpp
|
||||
/// @date 2010-03-17 / 2011-06-15
|
||||
/// @author Christophe Riccio
|
||||
///
|
||||
/// @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>
|
||||
/// @see gtc_packing
|
||||
///
|
||||
/// @defgroup core_func_packing Floating-Point Pack and Unpack Functions
|
||||
/// @ingroup core
|
||||
@ -33,8 +38,7 @@
|
||||
/// These functions do not operate component-wise, rather as described in each case.
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef GLM_CORE_func_packing
|
||||
#define GLM_CORE_func_packing
|
||||
#pragma once
|
||||
|
||||
#include "type_vec2.hpp"
|
||||
#include "type_vec4.hpp"
|
||||
@ -191,5 +195,3 @@ namespace glm
|
||||
}//namespace glm
|
||||
|
||||
#include "func_packing.inl"
|
||||
|
||||
#endif//GLM_CORE_func_packing
|
||||
|
||||
@ -12,6 +12,10 @@
|
||||
/// 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
|
||||
@ -21,7 +25,7 @@
|
||||
/// THE SOFTWARE.
|
||||
///
|
||||
/// @ref core
|
||||
/// @file glm/core/func_packing.inl
|
||||
/// @file glm/detail/func_packing.inl
|
||||
/// @date 2010-03-17 / 2011-06-15
|
||||
/// @author Christophe Riccio
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
@ -35,7 +39,9 @@ namespace glm
|
||||
GLM_FUNC_QUALIFIER uint packUnorm2x16(vec2 const & v)
|
||||
{
|
||||
u16vec2 Topack(round(clamp(v, 0.0f, 1.0f) * 65535.0f));
|
||||
return reinterpret_cast<uint&>(Topack);
|
||||
// return reinterpret_cast<uint&>(Topack);
|
||||
uint* ptr(reinterpret_cast<uint*>(&Topack));
|
||||
return *ptr;
|
||||
}
|
||||
|
||||
GLM_FUNC_QUALIFIER vec2 unpackUnorm2x16(uint const & p)
|
||||
@ -47,7 +53,9 @@ namespace glm
|
||||
GLM_FUNC_QUALIFIER uint packSnorm2x16(vec2 const & v)
|
||||
{
|
||||
i16vec2 Topack(round(clamp(v ,-1.0f, 1.0f) * 32767.0f));
|
||||
return reinterpret_cast<uint32&>(Topack);
|
||||
// return reinterpret_cast<uint32&>(Topack);
|
||||
uint* ptr(reinterpret_cast<uint*>(&Topack));
|
||||
return *ptr;
|
||||
}
|
||||
|
||||
GLM_FUNC_QUALIFIER vec2 unpackSnorm2x16(uint const & p)
|
||||
|
||||
@ -12,6 +12,10 @@
|
||||
/// 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
|
||||
@ -21,7 +25,7 @@
|
||||
/// THE SOFTWARE.
|
||||
///
|
||||
/// @ref core
|
||||
/// @file glm/core/func_trigonometric.hpp
|
||||
/// @file glm/detail/func_trigonometric.hpp
|
||||
/// @date 2008-08-01 / 2011-06-15
|
||||
/// @author Christophe Riccio
|
||||
///
|
||||
@ -37,8 +41,10 @@
|
||||
/// These all operate component-wise. The description is per component.
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef GLM_CORE_func_trigonometric
|
||||
#define GLM_CORE_func_trigonometric
|
||||
#pragma once
|
||||
|
||||
#include "setup.hpp"
|
||||
#include "precision.hpp"
|
||||
|
||||
namespace glm
|
||||
{
|
||||
@ -51,8 +57,8 @@ 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 genType>
|
||||
GLM_FUNC_DECL genType radians(genType const & degrees);
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<T, P> radians(vecType<T, P> const & degrees);
|
||||
|
||||
/// Converts radians to degrees and returns the result.
|
||||
///
|
||||
@ -60,8 +66,8 @@ 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 genType>
|
||||
GLM_FUNC_DECL genType degrees(genType const & radians);
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL 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].
|
||||
@ -70,8 +76,8 @@ namespace glm
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/sin.xml">GLSL sin 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 genType>
|
||||
GLM_FUNC_DECL genType sin(genType const & angle);
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<T, P> sin(vecType<T, P> const & angle);
|
||||
|
||||
/// The standard trigonometric cosine function.
|
||||
/// The values returned by this function will range from [-1, 1].
|
||||
@ -80,8 +86,8 @@ namespace glm
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/cos.xml">GLSL cos 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 genType>
|
||||
GLM_FUNC_DECL genType cos(genType const & angle);
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<T, P> cos(vecType<T, P> const & angle);
|
||||
|
||||
/// The standard trigonometric tangent function.
|
||||
///
|
||||
@ -89,8 +95,8 @@ namespace glm
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/tan.xml">GLSL tan 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 genType>
|
||||
GLM_FUNC_DECL genType tan(genType const & angle);
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<T, P> tan(vecType<T, P> const & angle);
|
||||
|
||||
/// Arc sine. Returns an angle whose sine is x.
|
||||
/// The range of values returned by this function is [-PI/2, PI/2].
|
||||
@ -100,8 +106,8 @@ namespace glm
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/asin.xml">GLSL asin 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 genType>
|
||||
GLM_FUNC_DECL genType asin(genType const & x);
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<T, P> asin(vecType<T, P> const & x);
|
||||
|
||||
/// Arc cosine. Returns an angle whose sine is x.
|
||||
/// The range of values returned by this function is [0, PI].
|
||||
@ -111,8 +117,8 @@ namespace glm
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/acos.xml">GLSL acos 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 genType>
|
||||
GLM_FUNC_DECL genType acos(genType const & x);
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<T, P> acos(vecType<T, P> const & x);
|
||||
|
||||
/// Arc tangent. Returns an angle whose tangent is y/x.
|
||||
/// The signs of x and y are used to determine what
|
||||
@ -124,8 +130,8 @@ namespace glm
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/atan.xml">GLSL atan 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 genType>
|
||||
GLM_FUNC_DECL genType atan(genType const & y, genType const & x);
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<T, P> atan(vecType<T, P> const & y, vecType<T, P> const & x);
|
||||
|
||||
/// Arc tangent. Returns an angle whose tangent is y_over_x.
|
||||
/// The range of values returned by this function is [-PI/2, PI/2].
|
||||
@ -134,8 +140,8 @@ namespace glm
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/atan.xml">GLSL atan 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 genType>
|
||||
GLM_FUNC_DECL genType atan(genType const & y_over_x);
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<T, P> atan(vecType<T, P> const & y_over_x);
|
||||
|
||||
/// Returns the hyperbolic sine function, (exp(x) - exp(-x)) / 2
|
||||
///
|
||||
@ -143,8 +149,8 @@ namespace glm
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/sinh.xml">GLSL sinh 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 genType>
|
||||
GLM_FUNC_DECL genType sinh(genType const & angle);
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<T, P> sinh(vecType<T, P> const & angle);
|
||||
|
||||
/// Returns the hyperbolic cosine function, (exp(x) + exp(-x)) / 2
|
||||
///
|
||||
@ -152,8 +158,8 @@ namespace glm
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/cosh.xml">GLSL cosh 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 genType>
|
||||
GLM_FUNC_DECL genType cosh(genType const & angle);
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<T, P> cosh(vecType<T, P> const & angle);
|
||||
|
||||
/// Returns the hyperbolic tangent function, sinh(angle) / cosh(angle)
|
||||
///
|
||||
@ -161,8 +167,8 @@ namespace glm
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/tanh.xml">GLSL tanh 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 genType>
|
||||
GLM_FUNC_DECL genType tanh(genType const & angle);
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<T, P> tanh(vecType<T, P> const & angle);
|
||||
|
||||
/// Arc hyperbolic sine; returns the inverse of sinh.
|
||||
///
|
||||
@ -170,8 +176,8 @@ namespace glm
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/asinh.xml">GLSL asinh 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 genType>
|
||||
GLM_FUNC_DECL genType asinh(genType const & x);
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<T, P> asinh(vecType<T, P> const & x);
|
||||
|
||||
/// Arc hyperbolic cosine; returns the non-negative inverse
|
||||
/// of cosh. Results are undefined if x < 1.
|
||||
@ -180,8 +186,8 @@ namespace glm
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/acosh.xml">GLSL acosh 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 genType>
|
||||
GLM_FUNC_DECL genType acosh(genType const & x);
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<T, P> acosh(vecType<T, P> const & x);
|
||||
|
||||
/// Arc hyperbolic tangent; returns the inverse of tanh.
|
||||
/// Results are undefined if abs(x) >= 1.
|
||||
@ -190,14 +196,10 @@ namespace glm
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/atanh.xml">GLSL atanh 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 genType>
|
||||
GLM_FUNC_DECL genType atanh(genType const & x);
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<T, P> atanh(vecType<T, P> const & x);
|
||||
|
||||
/// @}
|
||||
}//namespace glm
|
||||
|
||||
#include "func_trigonometric.inl"
|
||||
|
||||
#endif//GLM_CORE_func_trigonometric
|
||||
|
||||
|
||||
|
||||
@ -12,6 +12,10 @@
|
||||
/// 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
|
||||
@ -21,7 +25,7 @@
|
||||
/// THE SOFTWARE.
|
||||
///
|
||||
/// @ref core
|
||||
/// @file glm/core/func_trigonometric.inl
|
||||
/// @file glm/detail/func_trigonometric.inl
|
||||
/// @date 2008-08-03 / 2011-06-15
|
||||
/// @author Christophe Riccio
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
@ -34,213 +38,187 @@ namespace glm
|
||||
{
|
||||
// radians
|
||||
template <typename genType>
|
||||
GLM_FUNC_QUALIFIER genType radians
|
||||
(
|
||||
genType const & degrees
|
||||
)
|
||||
GLM_FUNC_QUALIFIER genType radians(genType degrees)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'radians' only accept floating-point input");
|
||||
|
||||
return degrees * genType(0.01745329251994329576923690768489);
|
||||
return degrees * static_cast<genType>(0.01745329251994329576923690768489);
|
||||
}
|
||||
|
||||
VECTORIZE_VEC(radians)
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER 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 const & radians
|
||||
)
|
||||
GLM_FUNC_QUALIFIER genType degrees(genType radians)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'degrees' only accept floating-point input");
|
||||
|
||||
return radians * genType(57.295779513082320876798154814105);
|
||||
return radians * static_cast<genType>(57.295779513082320876798154814105);
|
||||
}
|
||||
|
||||
VECTORIZE_VEC(degrees)
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<T, P> degrees(vecType<T, P> const & v)
|
||||
{
|
||||
return detail::functor1<T, T, P, vecType>::call(degrees, v);
|
||||
}
|
||||
|
||||
// sin
|
||||
template <typename genType>
|
||||
GLM_FUNC_QUALIFIER genType sin
|
||||
(
|
||||
genType const & angle
|
||||
)
|
||||
using ::std::sin;
|
||||
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<T, P> sin(vecType<T, P> const & v)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'sin' only accept floating-point input");
|
||||
|
||||
return genType(::std::sin(angle));
|
||||
return detail::functor1<T, T, P, vecType>::call(sin, v);
|
||||
}
|
||||
|
||||
VECTORIZE_VEC(sin)
|
||||
|
||||
// cos
|
||||
template <typename genType>
|
||||
GLM_FUNC_QUALIFIER genType cos(genType const & angle)
|
||||
using std::cos;
|
||||
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<T, P> cos(vecType<T, P> const & v)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'cos' only accept floating-point input");
|
||||
|
||||
return genType(::std::cos(angle));
|
||||
return detail::functor1<T, T, P, vecType>::call(cos, v);
|
||||
}
|
||||
|
||||
VECTORIZE_VEC(cos)
|
||||
|
||||
// tan
|
||||
template <typename genType>
|
||||
GLM_FUNC_QUALIFIER genType tan
|
||||
(
|
||||
genType const & angle
|
||||
)
|
||||
using std::tan;
|
||||
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<T, P> tan(vecType<T, P> const & v)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'tan' only accept floating-point input");
|
||||
|
||||
return genType(::std::tan(angle));
|
||||
return detail::functor1<T, T, P, vecType>::call(tan, v);
|
||||
}
|
||||
|
||||
VECTORIZE_VEC(tan)
|
||||
|
||||
// asin
|
||||
template <typename genType>
|
||||
GLM_FUNC_QUALIFIER genType asin
|
||||
(
|
||||
genType const & x
|
||||
)
|
||||
using std::asin;
|
||||
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<T, P> asin(vecType<T, P> const & v)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'asin' only accept floating-point input");
|
||||
|
||||
return genType(::std::asin(x));
|
||||
return detail::functor1<T, T, P, vecType>::call(asin, v);
|
||||
}
|
||||
|
||||
VECTORIZE_VEC(asin)
|
||||
|
||||
// acos
|
||||
template <typename genType>
|
||||
GLM_FUNC_QUALIFIER genType acos
|
||||
(
|
||||
genType const & x
|
||||
)
|
||||
using std::acos;
|
||||
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<T, P> acos(vecType<T, P> const & v)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'acos' only accept floating-point input");
|
||||
|
||||
return genType(::std::acos(x));
|
||||
return detail::functor1<T, T, P, vecType>::call(acos, v);
|
||||
}
|
||||
|
||||
VECTORIZE_VEC(acos)
|
||||
|
||||
// atan
|
||||
template <typename genType>
|
||||
GLM_FUNC_QUALIFIER genType atan
|
||||
(
|
||||
genType const & y,
|
||||
genType const & x
|
||||
)
|
||||
GLM_FUNC_QUALIFIER genType atan(genType const & y, genType const & x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'atan' only accept floating-point input");
|
||||
|
||||
return genType(::std::atan2(y, x));
|
||||
return ::std::atan2(y, x);
|
||||
}
|
||||
|
||||
VECTORIZE_VEC_VEC(atan)
|
||||
|
||||
template <typename genType>
|
||||
GLM_FUNC_QUALIFIER genType atan
|
||||
(
|
||||
genType const & x
|
||||
)
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<T, P> atan(vecType<T, P> const & a, vecType<T, P> const & b)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'atan' only accept floating-point input");
|
||||
|
||||
return genType(::std::atan(x));
|
||||
return detail::functor2<T, P, vecType>::call(atan2, a, b);
|
||||
}
|
||||
|
||||
VECTORIZE_VEC(atan)
|
||||
using std::atan;
|
||||
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<T, P> atan(vecType<T, P> const & v)
|
||||
{
|
||||
return detail::functor1<T, T, P, vecType>::call(atan, v);
|
||||
}
|
||||
|
||||
// sinh
|
||||
template <typename genType>
|
||||
GLM_FUNC_QUALIFIER genType sinh
|
||||
(
|
||||
genType const & angle
|
||||
)
|
||||
using std::sinh;
|
||||
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<T, P> sinh(vecType<T, P> const & v)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'sinh' only accept floating-point input");
|
||||
|
||||
return genType(std::sinh(angle));
|
||||
return detail::functor1<T, T, P, vecType>::call(sinh, v);
|
||||
}
|
||||
|
||||
VECTORIZE_VEC(sinh)
|
||||
|
||||
// cosh
|
||||
template <typename genType>
|
||||
GLM_FUNC_QUALIFIER genType cosh
|
||||
(
|
||||
genType const & angle
|
||||
)
|
||||
using std::cosh;
|
||||
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<T, P> cosh(vecType<T, P> const & v)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'cosh' only accept floating-point input");
|
||||
|
||||
return genType(std::cosh(angle));
|
||||
return detail::functor1<T, T, P, vecType>::call(cosh, v);
|
||||
}
|
||||
|
||||
VECTORIZE_VEC(cosh)
|
||||
|
||||
// tanh
|
||||
template <typename genType>
|
||||
GLM_FUNC_QUALIFIER genType tanh
|
||||
(
|
||||
genType const & angle
|
||||
)
|
||||
using std::tanh;
|
||||
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<T, P> tanh(vecType<T, P> const & v)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'tanh' only accept floating-point input");
|
||||
|
||||
return genType(std::tanh(angle));
|
||||
return detail::functor1<T, T, P, vecType>::call(tanh, v);
|
||||
}
|
||||
|
||||
VECTORIZE_VEC(tanh)
|
||||
|
||||
// asinh
|
||||
template <typename genType>
|
||||
GLM_FUNC_QUALIFIER genType asinh
|
||||
(
|
||||
genType const & x
|
||||
)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'asinh' only accept floating-point input");
|
||||
|
||||
return (x < genType(0) ? genType(-1) : (x > genType(0) ? genType(1) : genType(0))) * log(abs(x) + sqrt(genType(1) + x * x));
|
||||
}
|
||||
# if GLM_HAS_CXX11_STL
|
||||
using std::asinh;
|
||||
# else
|
||||
template <typename genType>
|
||||
GLM_FUNC_QUALIFIER genType asinh(genType const & x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'asinh' only accept floating-point input");
|
||||
|
||||
VECTORIZE_VEC(asinh)
|
||||
return (x < static_cast<genType>(0) ? static_cast<genType>(-1) : (x > static_cast<genType>(0) ? static_cast<genType>(1) : static_cast<genType>(0))) * log(abs(x) + sqrt(static_cast<genType>(1) + x * x));
|
||||
}
|
||||
# endif
|
||||
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<T, P> asinh(vecType<T, P> const & v)
|
||||
{
|
||||
return detail::functor1<T, T, P, vecType>::call(asinh, v);
|
||||
}
|
||||
|
||||
// acosh
|
||||
template <typename genType>
|
||||
GLM_FUNC_QUALIFIER genType acosh
|
||||
(
|
||||
genType const & x
|
||||
)
|
||||
# if GLM_HAS_CXX11_STL
|
||||
using std::acosh;
|
||||
# else
|
||||
template <typename genType>
|
||||
GLM_FUNC_QUALIFIER genType acosh(genType const & x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'acosh' only accept floating-point input");
|
||||
|
||||
if(x < static_cast<genType>(1))
|
||||
return static_cast<genType>(0);
|
||||
return log(x + sqrt(x * x - static_cast<genType>(1)));
|
||||
}
|
||||
# endif
|
||||
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<T, P> acosh(vecType<T, P> const & v)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'acosh' only accept floating-point input");
|
||||
|
||||
if(x < genType(1))
|
||||
return genType(0);
|
||||
return log(x + sqrt(x * x - genType(1)));
|
||||
return detail::functor1<T, T, P, vecType>::call(acosh, v);
|
||||
}
|
||||
|
||||
VECTORIZE_VEC(acosh)
|
||||
|
||||
// atanh
|
||||
template <typename genType>
|
||||
GLM_FUNC_QUALIFIER genType atanh
|
||||
(
|
||||
genType const & x
|
||||
)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'atanh' only accept floating-point input");
|
||||
# if GLM_HAS_CXX11_STL
|
||||
using std::atanh;
|
||||
# else
|
||||
template <typename genType>
|
||||
GLM_FUNC_QUALIFIER genType atanh(genType const & x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'atanh' only accept floating-point input");
|
||||
|
||||
if(abs(x) >= genType(1))
|
||||
return 0;
|
||||
return genType(0.5) * log((genType(1) + x) / (genType(1) - x));
|
||||
if(abs(x) >= static_cast<genType>(1))
|
||||
return 0;
|
||||
return static_cast<genType>(0.5) * log((static_cast<genType>(1) + x) / (static_cast<genType>(1) - x));
|
||||
}
|
||||
# endif
|
||||
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<T, P> atanh(vecType<T, P> const & v)
|
||||
{
|
||||
return detail::functor1<T, T, P, vecType>::call(atanh, v);
|
||||
}
|
||||
|
||||
VECTORIZE_VEC(atanh)
|
||||
|
||||
}//namespace glm
|
||||
|
||||
@ -12,6 +12,10 @@
|
||||
/// 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
|
||||
@ -21,7 +25,7 @@
|
||||
/// THE SOFTWARE.
|
||||
///
|
||||
/// @ref core
|
||||
/// @file glm/core/func_vector_relational.hpp
|
||||
/// @file glm/detail/func_vector_relational.hpp
|
||||
/// @date 2008-08-03 / 2011-06-15
|
||||
/// @author Christophe Riccio
|
||||
///
|
||||
@ -38,14 +42,11 @@
|
||||
/// call must match.
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef GLM_CORE_func_vector_relational
|
||||
#define GLM_CORE_func_vector_relational
|
||||
#pragma once
|
||||
|
||||
#include "precision.hpp"
|
||||
#include "setup.hpp"
|
||||
|
||||
#if !((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER <= GLM_COMPILER_VC10)) // Workaround a Visual C++ bug
|
||||
|
||||
namespace glm
|
||||
{
|
||||
/// @addtogroup core_func_vector_relational
|
||||
@ -57,9 +58,8 @@ namespace glm
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/lessThan.xml">GLSL lessThan man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.7 Vector Relational Functions</a>
|
||||
// TODO: Mismatched
|
||||
//template <typename T, precision P, template <typename, precision> class vecType>
|
||||
//GLM_FUNC_DECL typename vecType<T, P>::bool_type lessThan(vecType<T, P> const & x, vecType<T, P> const & y);
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<bool, P> lessThan(vecType<T, P> const & x, vecType<T, P> const & y);
|
||||
|
||||
/// Returns the component-wise comparison of result x <= y.
|
||||
///
|
||||
@ -68,7 +68,7 @@ namespace glm
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/lessThanEqual.xml">GLSL lessThanEqual man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.7 Vector Relational Functions</a>
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL typename vecType<T, P>::bool_type lessThanEqual(vecType<T, P> const & x, vecType<T, P> const & y);
|
||||
GLM_FUNC_DECL vecType<bool, P> lessThanEqual(vecType<T, P> const & x, vecType<T, P> const & y);
|
||||
|
||||
/// Returns the component-wise comparison of result x > y.
|
||||
///
|
||||
@ -77,7 +77,7 @@ namespace glm
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/greaterThan.xml">GLSL greaterThan man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.7 Vector Relational Functions</a>
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL typename vecType<T, P>::bool_type greaterThan(vecType<T, P> const & x, vecType<T, P> const & y);
|
||||
GLM_FUNC_DECL vecType<bool, P> greaterThan(vecType<T, P> const & x, vecType<T, P> const & y);
|
||||
|
||||
/// Returns the component-wise comparison of result x >= y.
|
||||
///
|
||||
@ -86,7 +86,7 @@ namespace glm
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/greaterThanEqual.xml">GLSL greaterThanEqual man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.7 Vector Relational Functions</a>
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL typename vecType<T, P>::bool_type greaterThanEqual(vecType<T, P> const & x, vecType<T, P> const & y);
|
||||
GLM_FUNC_DECL vecType<bool, P> greaterThanEqual(vecType<T, P> const & x, vecType<T, P> const & y);
|
||||
|
||||
/// Returns the component-wise comparison of result x == y.
|
||||
///
|
||||
@ -94,9 +94,8 @@ namespace glm
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/equal.xml">GLSL equal man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.7 Vector Relational Functions</a>
|
||||
//TODO: conflicts with definision
|
||||
//template <typename T, precision P, template <typename, precision> class vecType>
|
||||
//GLM_FUNC_DECL typename vecType<T, P>::bool_type equal(vecType<T, P> const & x, vecType<T, P> const & y);
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<bool, P> equal(vecType<T, P> const & x, vecType<T, P> const & y);
|
||||
|
||||
/// Returns the component-wise comparison of result x != y.
|
||||
///
|
||||
@ -105,7 +104,7 @@ namespace glm
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/notEqual.xml">GLSL notEqual man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.7 Vector Relational Functions</a>
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL typename vecType<T, P>::bool_type notEqual(vecType<T, P> const & x, vecType<T, P> const & y);
|
||||
GLM_FUNC_DECL vecType<bool, P> notEqual(vecType<T, P> const & x, vecType<T, P> const & y);
|
||||
|
||||
/// Returns true if any component of x is true.
|
||||
///
|
||||
@ -138,8 +137,4 @@ namespace glm
|
||||
/// @}
|
||||
}//namespace glm
|
||||
|
||||
#endif
|
||||
|
||||
#include "func_vector_relational.inl"
|
||||
|
||||
#endif//GLM_CORE_func_vector_relational
|
||||
|
||||
@ -12,6 +12,10 @@
|
||||
/// 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
|
||||
@ -21,7 +25,7 @@
|
||||
/// THE SOFTWARE.
|
||||
///
|
||||
/// @ref core
|
||||
/// @file glm/core/func_vector_relational.inl
|
||||
/// @file glm/detail/func_vector_relational.inl
|
||||
/// @date 2008-08-03 / 2011-09-09
|
||||
/// @author Christophe Riccio
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
@ -31,100 +35,68 @@
|
||||
namespace glm
|
||||
{
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER typename vecType<T, P>::bool_type lessThan
|
||||
(
|
||||
vecType<T, P> const & x,
|
||||
vecType<T, P> const & y
|
||||
)
|
||||
GLM_FUNC_QUALIFIER vecType<bool, P> lessThan(vecType<T, P> const & x, vecType<T, P> const & y)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || std::numeric_limits<T>::is_integer,
|
||||
"Invalid template instantiation of 'lessThan', GLM vector types required floating-point or integer value types vectors");
|
||||
assert(x.length() == y.length());
|
||||
assert(detail::component_count(x) == detail::component_count(y));
|
||||
|
||||
typename vecType<bool, P>::bool_type Result(vecType<bool, P>::_null);
|
||||
for(int i = 0; i < x.length(); ++i)
|
||||
vecType<bool, P> Result(uninitialize);
|
||||
for(detail::component_count_t i = 0; i < detail::component_count(x); ++i)
|
||||
Result[i] = x[i] < y[i];
|
||||
|
||||
return Result;
|
||||
}
|
||||
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER typename vecType<T, P>::bool_type lessThanEqual
|
||||
(
|
||||
vecType<T, P> const & x,
|
||||
vecType<T, P> const & y
|
||||
)
|
||||
GLM_FUNC_QUALIFIER vecType<bool, P> lessThanEqual(vecType<T, P> const & x, vecType<T, P> const & y)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || std::numeric_limits<T>::is_integer,
|
||||
"Invalid template instantiation of 'lessThanEqual', GLM vector types required floating-point or integer value types vectors");
|
||||
assert(x.length() == y.length());
|
||||
assert(detail::component_count(x) == detail::component_count(y));
|
||||
|
||||
typename vecType<bool, P>::bool_type Result(vecType<bool, P>::_null);
|
||||
for(int i = 0; i < x.length(); ++i)
|
||||
vecType<bool, P> Result(uninitialize);
|
||||
for(detail::component_count_t i = 0; i < detail::component_count(x); ++i)
|
||||
Result[i] = x[i] <= y[i];
|
||||
return Result;
|
||||
}
|
||||
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER typename vecType<T, P>::bool_type greaterThan
|
||||
(
|
||||
vecType<T, P> const & x,
|
||||
vecType<T, P> const & y
|
||||
)
|
||||
GLM_FUNC_QUALIFIER vecType<bool, P> greaterThan(vecType<T, P> const & x, vecType<T, P> const & y)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || std::numeric_limits<T>::is_integer,
|
||||
"Invalid template instantiation of 'greaterThan', GLM vector types required floating-point or integer value types vectors");
|
||||
assert(x.length() == y.length());
|
||||
assert(detail::component_count(x) == detail::component_count(y));
|
||||
|
||||
typename vecType<bool, P>::bool_type Result(vecType<bool, P>::_null);
|
||||
for(int i = 0; i < x.length(); ++i)
|
||||
vecType<bool, P> Result(uninitialize);
|
||||
for(detail::component_count_t i = 0; i < detail::component_count(x); ++i)
|
||||
Result[i] = x[i] > y[i];
|
||||
return Result;
|
||||
}
|
||||
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER typename vecType<T, P>::bool_type greaterThanEqual
|
||||
(
|
||||
vecType<T, P> const & x,
|
||||
vecType<T, P> const & y
|
||||
)
|
||||
GLM_FUNC_QUALIFIER vecType<bool, P> greaterThanEqual(vecType<T, P> const & x, vecType<T, P> const & y)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || std::numeric_limits<T>::is_integer,
|
||||
"Invalid template instantiation of 'greaterThanEqual', GLM vector types required floating-point or integer value types vectors");
|
||||
assert(x.length() == y.length());
|
||||
assert(detail::component_count(x) == detail::component_count(y));
|
||||
|
||||
typename vecType<bool, P>::bool_type Result(vecType<bool, P>::_null);
|
||||
for(int i = 0; i < x.length(); ++i)
|
||||
vecType<bool, P> Result(uninitialize);
|
||||
for(detail::component_count_t i = 0; i < detail::component_count(x); ++i)
|
||||
Result[i] = x[i] >= y[i];
|
||||
return Result;
|
||||
}
|
||||
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER typename vecType<T, P>::bool_type equal
|
||||
(
|
||||
vecType<T, P> const & x,
|
||||
vecType<T, P> const & y
|
||||
)
|
||||
GLM_FUNC_QUALIFIER vecType<bool, P> equal(vecType<T, P> const & x, vecType<T, P> const & y)
|
||||
{
|
||||
assert(x.length() == y.length());
|
||||
assert(detail::component_count(x) == detail::component_count(y));
|
||||
|
||||
typename vecType<bool, P>::bool_type Result(vecType<bool, P>::_null);
|
||||
for(int i = 0; i < x.length(); ++i)
|
||||
vecType<bool, P> Result(uninitialize);
|
||||
for(detail::component_count_t i = 0; i < detail::component_count(x); ++i)
|
||||
Result[i] = x[i] == y[i];
|
||||
return Result;
|
||||
}
|
||||
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER typename vecType<T, P>::bool_type notEqual
|
||||
(
|
||||
vecType<T, P> const & x,
|
||||
vecType<T, P> const & y
|
||||
)
|
||||
GLM_FUNC_QUALIFIER vecType<bool, P> notEqual(vecType<T, P> const & x, vecType<T, P> const & y)
|
||||
{
|
||||
assert(x.length() == y.length());
|
||||
assert(detail::component_count(x) == detail::component_count(y));
|
||||
|
||||
typename vecType<bool, P>::bool_type Result(vecType<bool, P>::_null);
|
||||
for(int i = 0; i < x.length(); ++i)
|
||||
vecType<bool, P> Result(uninitialize);
|
||||
for(detail::component_count_t i = 0; i < detail::component_count(x); ++i)
|
||||
Result[i] = x[i] != y[i];
|
||||
return Result;
|
||||
}
|
||||
@ -133,7 +105,7 @@ namespace glm
|
||||
GLM_FUNC_QUALIFIER bool any(vecType<bool, P> const & v)
|
||||
{
|
||||
bool Result = false;
|
||||
for(int i = 0; i < v.length(); ++i)
|
||||
for(detail::component_count_t i = 0; i < detail::component_count(v); ++i)
|
||||
Result = Result || v[i];
|
||||
return Result;
|
||||
}
|
||||
@ -142,7 +114,7 @@ namespace glm
|
||||
GLM_FUNC_QUALIFIER bool all(vecType<bool, P> const & v)
|
||||
{
|
||||
bool Result = true;
|
||||
for(int i = 0; i < v.length(); ++i)
|
||||
for(detail::component_count_t i = 0; i < detail::component_count(v); ++i)
|
||||
Result = Result && v[i];
|
||||
return Result;
|
||||
}
|
||||
@ -150,8 +122,8 @@ namespace glm
|
||||
template <precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<bool, P> not_(vecType<bool, P> const & v)
|
||||
{
|
||||
typename vecType<bool, P>::bool_type Result(vecType<bool, P>::_null);
|
||||
for(int i = 0; i < v.length(); ++i)
|
||||
vecType<bool, P> Result(uninitialize);
|
||||
for(detail::component_count_t i = 0; i < detail::component_count(v); ++i)
|
||||
Result[i] = !v[i];
|
||||
return Result;
|
||||
}
|
||||
|
||||
@ -12,6 +12,10 @@
|
||||
/// 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
|
||||
@ -30,11 +34,9 @@
|
||||
#include <glm/gtc/quaternion.hpp>
|
||||
#include <glm/gtx/dual_quaternion.hpp>
|
||||
|
||||
namespace glm{
|
||||
namespace detail
|
||||
namespace glm
|
||||
{
|
||||
// tvec1 type explicit instantiation
|
||||
/*
|
||||
template struct tvec1<uint8, lowp>;
|
||||
template struct tvec1<uint16, lowp>;
|
||||
template struct tvec1<uint32, lowp>;
|
||||
@ -43,7 +45,6 @@ template struct tvec1<int8, lowp>;
|
||||
template struct tvec1<int16, lowp>;
|
||||
template struct tvec1<int32, lowp>;
|
||||
template struct tvec1<int64, lowp>;
|
||||
template struct tvec1<float16, lowp>;
|
||||
template struct tvec1<float32, lowp>;
|
||||
template struct tvec1<float64, lowp>;
|
||||
|
||||
@ -55,7 +56,6 @@ template struct tvec1<int8, mediump>;
|
||||
template struct tvec1<int16, mediump>;
|
||||
template struct tvec1<int32, mediump>;
|
||||
template struct tvec1<int64, mediump>;
|
||||
template struct tvec1<float16, mediump>;
|
||||
template struct tvec1<float32, mediump>;
|
||||
template struct tvec1<float64, mediump>;
|
||||
|
||||
@ -67,10 +67,9 @@ template struct tvec1<int8, highp>;
|
||||
template struct tvec1<int16, highp>;
|
||||
template struct tvec1<int32, highp>;
|
||||
template struct tvec1<int64, highp>;
|
||||
template struct tvec1<float16, highp>;
|
||||
template struct tvec1<float32, highp>;
|
||||
template struct tvec1<float64, highp>;
|
||||
*/
|
||||
|
||||
// tvec2 type explicit instantiation
|
||||
template struct tvec2<uint8, lowp>;
|
||||
template struct tvec2<uint16, lowp>;
|
||||
@ -283,6 +282,5 @@ template struct tdualquat<float64, mediump>;
|
||||
template struct tdualquat<float32, highp>;
|
||||
template struct tdualquat<float64, highp>;
|
||||
|
||||
}//namespace detail
|
||||
}//namespace glm
|
||||
|
||||
|
||||
@ -21,13 +21,12 @@
|
||||
/// THE SOFTWARE.
|
||||
///
|
||||
/// @ref core
|
||||
/// @file glm/core/intrinsic_common.hpp
|
||||
/// @file glm/detail/intrinsic_common.hpp
|
||||
/// @date 2009-05-11 / 2011-06-15
|
||||
/// @author Christophe Riccio
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef glm_detail_intrinsic_common
|
||||
#define glm_detail_intrinsic_common
|
||||
#pragma once
|
||||
|
||||
#include "setup.hpp"
|
||||
|
||||
@ -86,4 +85,3 @@ namespace detail
|
||||
#include "intrinsic_common.inl"
|
||||
|
||||
#endif//GLM_ARCH
|
||||
#endif//glm_detail_intrinsic_common
|
||||
|
||||
@ -21,7 +21,7 @@
|
||||
/// THE SOFTWARE.
|
||||
///
|
||||
/// @ref core
|
||||
/// @file glm/core/intrinsic_common.inl
|
||||
/// @file glm/detail/intrinsic_common.inl
|
||||
/// @date 2009-05-08 / 2011-06-15
|
||||
/// @author Christophe Riccio
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@ -21,13 +21,12 @@
|
||||
/// THE SOFTWARE.
|
||||
///
|
||||
/// @ref core
|
||||
/// @file glm/core/intrinsic_exponential.hpp
|
||||
/// @file glm/detail/intrinsic_exponential.hpp
|
||||
/// @date 2009-05-11 / 2011-06-15
|
||||
/// @author Christophe Riccio
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef glm_detail_intrinsic_exponential
|
||||
#define glm_detail_intrinsic_exponential
|
||||
#pragma once
|
||||
|
||||
#include "setup.hpp"
|
||||
|
||||
@ -76,4 +75,3 @@ GLM_FUNC_QUALIFIER __m128 sse_normalize_fast_ps( float * RESTRICT vOut, float *
|
||||
}//namespace glm
|
||||
|
||||
#endif//GLM_ARCH
|
||||
#endif//glm_detail_intrinsic_exponential
|
||||
|
||||
@ -21,7 +21,7 @@
|
||||
/// THE SOFTWARE.
|
||||
///
|
||||
/// @ref core
|
||||
/// @file glm/core/intrinsic_exponential.inl
|
||||
/// @file glm/detail/intrinsic_exponential.inl
|
||||
/// @date 2011-06-15 / 2011-06-15
|
||||
/// @author Christophe Riccio
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@ -21,13 +21,12 @@
|
||||
/// THE SOFTWARE.
|
||||
///
|
||||
/// @ref core
|
||||
/// @file glm/core/intrinsic_geometric.hpp
|
||||
/// @file glm/detail/intrinsic_geometric.hpp
|
||||
/// @date 2009-05-08 / 2011-06-15
|
||||
/// @author Christophe Riccio
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef glm_core_intrinsic_geometric
|
||||
#define glm_core_intrinsic_geometric
|
||||
#pragma once
|
||||
|
||||
#include "setup.hpp"
|
||||
|
||||
@ -73,4 +72,3 @@ namespace detail
|
||||
#include "intrinsic_geometric.inl"
|
||||
|
||||
#endif//GLM_ARCH
|
||||
#endif//glm_core_intrinsic_geometric
|
||||
|
||||
@ -21,7 +21,7 @@
|
||||
/// THE SOFTWARE.
|
||||
///
|
||||
/// @ref core
|
||||
/// @file glm/core/intrinsic_geometric.inl
|
||||
/// @file glm/detail/intrinsic_geometric.inl
|
||||
/// @date 2009-05-08 / 2011-06-15
|
||||
/// @author Christophe Riccio
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
@ -32,32 +32,33 @@ namespace detail{
|
||||
//length
|
||||
GLM_FUNC_QUALIFIER __m128 sse_len_ps(__m128 x)
|
||||
{
|
||||
__m128 dot0 = sse_dot_ps(x, x);
|
||||
__m128 dot0 = sse_dot_ps(x, x);
|
||||
__m128 sqt0 = _mm_sqrt_ps(dot0);
|
||||
return sqt0;
|
||||
return sqt0;
|
||||
}
|
||||
|
||||
//distance
|
||||
GLM_FUNC_QUALIFIER __m128 sse_dst_ps(__m128 p0, __m128 p1)
|
||||
{
|
||||
__m128 sub0 = _mm_sub_ps(p0, p1);
|
||||
__m128 len0 = sse_len_ps(sub0);
|
||||
return len0;
|
||||
__m128 len0 = sse_len_ps(sub0);
|
||||
return len0;
|
||||
}
|
||||
|
||||
//dot
|
||||
GLM_FUNC_QUALIFIER __m128 sse_dot_ps(__m128 v1, __m128 v2)
|
||||
{
|
||||
# if((GLM_ARCH & GLM_ARCH_AVX) == GLM_ARCH_AVX)
|
||||
return _mm_dp_ps(v1, v2, 0xff);
|
||||
# else
|
||||
__m128 mul0 = _mm_mul_ps(v1, v2);
|
||||
__m128 swp0 = _mm_shuffle_ps(mul0, mul0, _MM_SHUFFLE(2, 3, 0, 1));
|
||||
__m128 add0 = _mm_add_ps(mul0, swp0);
|
||||
__m128 swp1 = _mm_shuffle_ps(add0, add0, _MM_SHUFFLE(0, 1, 2, 3));
|
||||
__m128 add1 = _mm_add_ps(add0, swp1);
|
||||
return add1;
|
||||
# endif
|
||||
|
||||
# if(GLM_ARCH & GLM_ARCH_AVX)
|
||||
return _mm_dp_ps(v1, v2, 0xff);
|
||||
# else
|
||||
__m128 mul0 = _mm_mul_ps(v1, v2);
|
||||
__m128 swp0 = _mm_shuffle_ps(mul0, mul0, _MM_SHUFFLE(2, 3, 0, 1));
|
||||
__m128 add0 = _mm_add_ps(mul0, swp0);
|
||||
__m128 swp1 = _mm_shuffle_ps(add0, add0, _MM_SHUFFLE(0, 1, 2, 3));
|
||||
__m128 add1 = _mm_add_ps(add0, swp1);
|
||||
return add1;
|
||||
# endif
|
||||
}
|
||||
|
||||
// SSE1
|
||||
|
||||
@ -21,13 +21,12 @@
|
||||
/// THE SOFTWARE.
|
||||
///
|
||||
/// @ref core
|
||||
/// @file glm/core/intrinsic_integer.hpp
|
||||
/// @file glm/detail/intrinsic_integer.hpp
|
||||
/// @date 2009-05-11 / 2011-06-15
|
||||
/// @author Christophe Riccio
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef glm_detail_intrinsic_integer
|
||||
#define glm_detail_intrinsic_integer
|
||||
#pragma once
|
||||
|
||||
#include "glm/glm.hpp"
|
||||
|
||||
@ -47,4 +46,3 @@ namespace detail
|
||||
#include "intrinsic_integer.inl"
|
||||
|
||||
#endif//GLM_ARCH
|
||||
#endif//glm_detail_intrinsic_integer
|
||||
|
||||
@ -21,7 +21,7 @@
|
||||
/// THE SOFTWARE.
|
||||
///
|
||||
/// @ref core
|
||||
/// @file glm/core/intrinsic_integer.inl
|
||||
/// @file glm/detail/intrinsic_integer.inl
|
||||
/// @date 2009-05-08 / 2011-06-15
|
||||
/// @author Christophe Riccio
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@ -21,13 +21,12 @@
|
||||
/// THE SOFTWARE.
|
||||
///
|
||||
/// @ref core
|
||||
/// @file glm/core/intrinsic_common.hpp
|
||||
/// @file glm/detail/intrinsic_common.hpp
|
||||
/// @date 2009-06-05 / 2011-06-15
|
||||
/// @author Christophe Riccio
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef glm_detail_intrinsic_matrix
|
||||
#define glm_detail_intrinsic_matrix
|
||||
#pragma once
|
||||
|
||||
#include "setup.hpp"
|
||||
|
||||
@ -66,4 +65,3 @@ namespace detail
|
||||
#include "intrinsic_matrix.inl"
|
||||
|
||||
#endif//GLM_ARCH
|
||||
#endif//glm_detail_intrinsic_matrix
|
||||
|
||||
@ -21,7 +21,7 @@
|
||||
/// THE SOFTWARE.
|
||||
///
|
||||
/// @ref core
|
||||
/// @file glm/core/intrinsic_common.inl
|
||||
/// @file glm/detail/intrinsic_common.inl
|
||||
/// @date 2009-06-05 / 2011-06-15
|
||||
/// @author Christophe Riccio
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
@ -448,7 +448,7 @@ GLM_FUNC_QUALIFIER __m128 sse_detd_ps
|
||||
__m128 MulC = _mm_mul_ps(Swp2C, Swp3C);
|
||||
__m128 SubF = _mm_sub_ps(_mm_movehl_ps(MulC, MulC), MulC);
|
||||
|
||||
//detail::tvec4<T, P> DetCof(
|
||||
//tvec4<T, P> DetCof(
|
||||
// + (m[1][1] * SubFactor00 - m[1][2] * SubFactor01 + m[1][3] * SubFactor02),
|
||||
// - (m[1][0] * SubFactor00 - m[1][2] * SubFactor03 + m[1][3] * SubFactor04),
|
||||
// + (m[1][0] * SubFactor01 - m[1][1] * SubFactor03 + m[1][3] * SubFactor05),
|
||||
@ -514,7 +514,7 @@ GLM_FUNC_QUALIFIER __m128 sse_det_ps
|
||||
__m128 MulC = _mm_mul_ps(Swp2C, Swp3C);
|
||||
__m128 SubF = _mm_sub_ps(_mm_movehl_ps(MulC, MulC), MulC);
|
||||
|
||||
//detail::tvec4<T, P> DetCof(
|
||||
//tvec4<T, P> DetCof(
|
||||
// + (m[1][1] * SubFactor00 - m[1][2] * SubFactor01 + m[1][3] * SubFactor02),
|
||||
// - (m[1][0] * SubFactor00 - m[1][2] * SubFactor03 + m[1][3] * SubFactor04),
|
||||
// + (m[1][0] * SubFactor01 - m[1][1] * SubFactor03 + m[1][3] * SubFactor05),
|
||||
@ -1003,7 +1003,7 @@ GLM_FUNC_QUALIFIER void sse_rotate_ps(__m128 const in[4], float Angle, float con
|
||||
__m128 Sin0 = _mm_set_ss(s);
|
||||
__m128 SinA = _mm_shuffle_ps(Sin0, Sin0, _MM_SHUFFLE(0, 0, 0, 0));
|
||||
|
||||
// detail::tvec3<T, P> temp = (valType(1) - c) * axis;
|
||||
// tvec3<T, P> temp = (valType(1) - c) * axis;
|
||||
__m128 Temp0 = _mm_sub_ps(one, CosA);
|
||||
__m128 Temp1 = _mm_mul_ps(Temp0, AxisC);
|
||||
|
||||
@ -1049,7 +1049,7 @@ GLM_FUNC_QUALIFIER void sse_rotate_ps(__m128 const in[4], float Angle, float con
|
||||
Result[2] = TmpC4;
|
||||
Result[3] = _mm_set_ps(1, 0, 0, 0);
|
||||
|
||||
//detail::tmat4x4<valType> Result(detail::tmat4x4<valType>::_null);
|
||||
//tmat4x4<valType> Result(uninitialize);
|
||||
//Result[0] = m[0] * Rotate[0][0] + m[1] * Rotate[0][1] + m[2] * Rotate[0][2];
|
||||
//Result[1] = m[0] * Rotate[1][0] + m[1] * Rotate[1][1] + m[2] * Rotate[1][2];
|
||||
//Result[2] = m[0] * Rotate[2][0] + m[1] * Rotate[2][1] + m[2] * Rotate[2][2];
|
||||
|
||||
@ -21,13 +21,12 @@
|
||||
/// THE SOFTWARE.
|
||||
///
|
||||
/// @ref core
|
||||
/// @file glm/core/intrinsic_trigonometric.hpp
|
||||
/// @file glm/detail/intrinsic_trigonometric.hpp
|
||||
/// @date 2009-06-09 / 2011-06-15
|
||||
/// @author Christophe Riccio
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef glm_detail_intrinsic_trigonometric
|
||||
#define glm_detail_intrinsic_trigonometric
|
||||
#pragma once
|
||||
|
||||
#include "setup.hpp"
|
||||
|
||||
@ -45,4 +44,3 @@ namespace detail
|
||||
#include "intrinsic_trigonometric.inl"
|
||||
|
||||
#endif//GLM_ARCH
|
||||
#endif//glm_detail_intrinsic_trigonometric
|
||||
|
||||
@ -21,7 +21,7 @@
|
||||
/// THE SOFTWARE.
|
||||
///
|
||||
/// @ref core
|
||||
/// @file glm/core/intrinsic_trigonometric.inl
|
||||
/// @file glm/detail/intrinsic_trigonometric.inl
|
||||
/// @date 2011-06-15 / 2011-06-15
|
||||
/// @author Christophe Riccio
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@ -21,13 +21,12 @@
|
||||
/// THE SOFTWARE.
|
||||
///
|
||||
/// @ref core
|
||||
/// @file glm/core/intrinsic_vector_relational.hpp
|
||||
/// @file glm/detail/intrinsic_vector_relational.hpp
|
||||
/// @date 2009-06-09 / 2011-06-15
|
||||
/// @author Christophe Riccio
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef glm_detail_intrinsic_vector_relational
|
||||
#define glm_detail_intrinsic_vector_relational
|
||||
#pragma once
|
||||
|
||||
#include "setup.hpp"
|
||||
|
||||
@ -45,4 +44,3 @@ namespace detail
|
||||
#include "intrinsic_vector_relational.inl"
|
||||
|
||||
#endif//GLM_ARCH
|
||||
#endif//glm_detail_intrinsic_vector_relational
|
||||
|
||||
@ -21,17 +21,17 @@
|
||||
/// THE SOFTWARE.
|
||||
///
|
||||
/// @ref core
|
||||
/// @file glm/core/intrinsic_vector_relational.inl
|
||||
/// @file glm/detail/intrinsic_vector_relational.inl
|
||||
/// @date 2009-06-09 / 2011-06-15
|
||||
/// @author Christophe Riccio
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
//// lessThan
|
||||
//template <typename valType>
|
||||
//GLM_FUNC_QUALIFIER typename detail::tvec2<T, P>::bool_type lessThan
|
||||
//GLM_FUNC_QUALIFIER typename tvec2<T, P>::bool_type lessThan
|
||||
//(
|
||||
// detail::tvec2<T, P> const & x,
|
||||
// detail::tvec2<T, P> const & y
|
||||
// tvec2<T, P> const & x,
|
||||
// tvec2<T, P> const & y
|
||||
//)
|
||||
//{
|
||||
// GLM_STATIC_ASSERT(
|
||||
@ -39,14 +39,14 @@
|
||||
// detail::type<valType>::is_int ||
|
||||
// detail::type<valType>::is_uint);
|
||||
//
|
||||
// return typename detail::tvec2<bool>::bool_type(x.x < y.x, x.y < y.y);
|
||||
// return typename tvec2<bool>::bool_type(x.x < y.x, x.y < y.y);
|
||||
//}
|
||||
//
|
||||
//template <typename valType>
|
||||
//GLM_FUNC_QUALIFIER typename detail::tvec3<T, P>::bool_type lessThan
|
||||
//GLM_FUNC_QUALIFIER typename tvec3<T, P>::bool_type lessThan
|
||||
//(
|
||||
// detail::tvec3<T, P> const & x,
|
||||
// detail::tvec3<T, P> const & y
|
||||
// tvec3<T, P> const & x,
|
||||
// tvec3<T, P> const & y
|
||||
//)
|
||||
//{
|
||||
// GLM_STATIC_ASSERT(
|
||||
@ -54,14 +54,14 @@
|
||||
// detail::type<valType>::is_int ||
|
||||
// detail::type<valType>::is_uint);
|
||||
//
|
||||
// return typename detail::tvec3<bool>::bool_type(x.x < y.x, x.y < y.y, x.z < y.z);
|
||||
// return typename tvec3<bool>::bool_type(x.x < y.x, x.y < y.y, x.z < y.z);
|
||||
//}
|
||||
//
|
||||
//template <typename valType>
|
||||
//GLM_FUNC_QUALIFIER typename detail::tvec4<T, P>::bool_type lessThan
|
||||
//GLM_FUNC_QUALIFIER typename tvec4<T, P>::bool_type lessThan
|
||||
//(
|
||||
// detail::tvec4<T, P> const & x,
|
||||
// detail::tvec4<T, P> const & y
|
||||
// tvec4<T, P> const & x,
|
||||
// tvec4<T, P> const & y
|
||||
//)
|
||||
//{
|
||||
// GLM_STATIC_ASSERT(
|
||||
@ -69,15 +69,15 @@
|
||||
// detail::type<valType>::is_int ||
|
||||
// detail::type<valType>::is_uint);
|
||||
//
|
||||
// return typename detail::tvec4<bool>::bool_type(x.x < y.x, x.y < y.y, x.z < y.z, x.w < y.w);
|
||||
// return typename tvec4<bool>::bool_type(x.x < y.x, x.y < y.y, x.z < y.z, x.w < y.w);
|
||||
//}
|
||||
//
|
||||
//// lessThanEqual
|
||||
//template <typename valType>
|
||||
//GLM_FUNC_QUALIFIER typename detail::tvec2<T, P>::bool_type lessThanEqual
|
||||
//GLM_FUNC_QUALIFIER typename tvec2<T, P>::bool_type lessThanEqual
|
||||
//(
|
||||
// detail::tvec2<T, P> const & x,
|
||||
// detail::tvec2<T, P> const & y
|
||||
// tvec2<T, P> const & x,
|
||||
// tvec2<T, P> const & y
|
||||
//)
|
||||
//{
|
||||
// GLM_STATIC_ASSERT(
|
||||
@ -85,14 +85,14 @@
|
||||
// detail::type<valType>::is_int ||
|
||||
// detail::type<valType>::is_uint);
|
||||
//
|
||||
// return typename detail::tvec2<bool>::bool_type(x.x <= y.x, x.y <= y.y);
|
||||
// return typename tvec2<bool>::bool_type(x.x <= y.x, x.y <= y.y);
|
||||
//}
|
||||
//
|
||||
//template <typename valType>
|
||||
//GLM_FUNC_QUALIFIER typename detail::tvec3<T, P>::bool_type lessThanEqual
|
||||
//GLM_FUNC_QUALIFIER typename tvec3<T, P>::bool_type lessThanEqual
|
||||
//(
|
||||
// detail::tvec3<T, P> const & x,
|
||||
// detail::tvec3<T, P> const & y
|
||||
// tvec3<T, P> const & x,
|
||||
// tvec3<T, P> const & y
|
||||
//)
|
||||
//{
|
||||
// GLM_STATIC_ASSERT(
|
||||
@ -100,14 +100,14 @@
|
||||
// detail::type<valType>::is_int ||
|
||||
// detail::type<valType>::is_uint);
|
||||
//
|
||||
// return typename detail::tvec3<bool>::bool_type(x.x <= y.x, x.y <= y.y, x.z <= y.z);
|
||||
// return typename tvec3<bool>::bool_type(x.x <= y.x, x.y <= y.y, x.z <= y.z);
|
||||
//}
|
||||
//
|
||||
//template <typename valType>
|
||||
//GLM_FUNC_QUALIFIER typename detail::tvec4<T, P>::bool_type lessThanEqual
|
||||
//GLM_FUNC_QUALIFIER typename tvec4<T, P>::bool_type lessThanEqual
|
||||
//(
|
||||
// detail::tvec4<T, P> const & x,
|
||||
// detail::tvec4<T, P> const & y
|
||||
// tvec4<T, P> const & x,
|
||||
// tvec4<T, P> const & y
|
||||
//)
|
||||
//{
|
||||
// GLM_STATIC_ASSERT(
|
||||
@ -115,15 +115,15 @@
|
||||
// detail::type<valType>::is_int ||
|
||||
// detail::type<valType>::is_uint);
|
||||
//
|
||||
// return typename detail::tvec4<bool>::bool_type(x.x <= y.x, x.y <= y.y, x.z <= y.z, x.w <= y.w);
|
||||
// return typename tvec4<bool>::bool_type(x.x <= y.x, x.y <= y.y, x.z <= y.z, x.w <= y.w);
|
||||
//}
|
||||
//
|
||||
//// greaterThan
|
||||
//template <typename valType>
|
||||
//GLM_FUNC_QUALIFIER typename detail::tvec2<T, P>::bool_type greaterThan
|
||||
//GLM_FUNC_QUALIFIER typename tvec2<T, P>::bool_type greaterThan
|
||||
//(
|
||||
// detail::tvec2<T, P> const & x,
|
||||
// detail::tvec2<T, P> const & y
|
||||
// tvec2<T, P> const & x,
|
||||
// tvec2<T, P> const & y
|
||||
//)
|
||||
//{
|
||||
// GLM_STATIC_ASSERT(
|
||||
@ -131,14 +131,14 @@
|
||||
// detail::type<valType>::is_int ||
|
||||
// detail::type<valType>::is_uint);
|
||||
//
|
||||
// return typename detail::tvec2<bool>::bool_type(x.x > y.x, x.y > y.y);
|
||||
// return typename tvec2<bool>::bool_type(x.x > y.x, x.y > y.y);
|
||||
//}
|
||||
//
|
||||
//template <typename valType>
|
||||
//GLM_FUNC_QUALIFIER typename detail::tvec3<T, P>::bool_type greaterThan
|
||||
//GLM_FUNC_QUALIFIER typename tvec3<T, P>::bool_type greaterThan
|
||||
//(
|
||||
// detail::tvec3<T, P> const & x,
|
||||
// detail::tvec3<T, P> const & y
|
||||
// tvec3<T, P> const & x,
|
||||
// tvec3<T, P> const & y
|
||||
//)
|
||||
//{
|
||||
// GLM_STATIC_ASSERT(
|
||||
@ -146,14 +146,14 @@
|
||||
// detail::type<valType>::is_int ||
|
||||
// detail::type<valType>::is_uint);
|
||||
//
|
||||
// return typename detail::tvec3<bool>::bool_type(x.x > y.x, x.y > y.y, x.z > y.z);
|
||||
// return typename tvec3<bool>::bool_type(x.x > y.x, x.y > y.y, x.z > y.z);
|
||||
//}
|
||||
//
|
||||
//template <typename valType>
|
||||
//GLM_FUNC_QUALIFIER typename detail::tvec4<T, P>::bool_type greaterThan
|
||||
//GLM_FUNC_QUALIFIER typename tvec4<T, P>::bool_type greaterThan
|
||||
//(
|
||||
// detail::tvec4<T, P> const & x,
|
||||
// detail::tvec4<T, P> const & y
|
||||
// tvec4<T, P> const & x,
|
||||
// tvec4<T, P> const & y
|
||||
//)
|
||||
//{
|
||||
// GLM_STATIC_ASSERT(
|
||||
@ -161,15 +161,15 @@
|
||||
// detail::type<valType>::is_int ||
|
||||
// detail::type<valType>::is_uint);
|
||||
//
|
||||
// return typename detail::tvec4<bool>::bool_type(x.x > y.x, x.y > y.y, x.z > y.z, x.w > y.w);
|
||||
// return typename tvec4<bool>::bool_type(x.x > y.x, x.y > y.y, x.z > y.z, x.w > y.w);
|
||||
//}
|
||||
//
|
||||
//// greaterThanEqual
|
||||
//template <typename valType>
|
||||
//GLM_FUNC_QUALIFIER typename detail::tvec2<T, P>::bool_type greaterThanEqual
|
||||
//GLM_FUNC_QUALIFIER typename tvec2<T, P>::bool_type greaterThanEqual
|
||||
//(
|
||||
// detail::tvec2<T, P> const & x,
|
||||
// detail::tvec2<T, P> const & y
|
||||
// tvec2<T, P> const & x,
|
||||
// tvec2<T, P> const & y
|
||||
//)
|
||||
//{
|
||||
// GLM_STATIC_ASSERT(
|
||||
@ -177,14 +177,14 @@
|
||||
// detail::type<valType>::is_int ||
|
||||
// detail::type<valType>::is_uint);
|
||||
//
|
||||
// return typename detail::tvec2<bool>::bool_type(x.x >= y.x, x.y >= y.y);
|
||||
// return typename tvec2<bool>::bool_type(x.x >= y.x, x.y >= y.y);
|
||||
//}
|
||||
//
|
||||
//template <typename valType>
|
||||
//GLM_FUNC_QUALIFIER typename detail::tvec3<T, P>::bool_type greaterThanEqual
|
||||
//GLM_FUNC_QUALIFIER typename tvec3<T, P>::bool_type greaterThanEqual
|
||||
//(
|
||||
// detail::tvec3<T, P> const & x,
|
||||
// detail::tvec3<T, P> const & y
|
||||
// tvec3<T, P> const & x,
|
||||
// tvec3<T, P> const & y
|
||||
//)
|
||||
//{
|
||||
// GLM_STATIC_ASSERT(
|
||||
@ -192,14 +192,14 @@
|
||||
// detail::type<valType>::is_int ||
|
||||
// detail::type<valType>::is_uint);
|
||||
//
|
||||
// return typename detail::tvec3<bool>::bool_type(x.x >= y.x, x.y >= y.y, x.z >= y.z);
|
||||
// return typename tvec3<bool>::bool_type(x.x >= y.x, x.y >= y.y, x.z >= y.z);
|
||||
//}
|
||||
//
|
||||
//template <typename valType>
|
||||
//GLM_FUNC_QUALIFIER typename detail::tvec4<T, P>::bool_type greaterThanEqual
|
||||
//GLM_FUNC_QUALIFIER typename tvec4<T, P>::bool_type greaterThanEqual
|
||||
//(
|
||||
// detail::tvec4<T, P> const & x,
|
||||
// detail::tvec4<T, P> const & y
|
||||
// tvec4<T, P> const & x,
|
||||
// tvec4<T, P> const & y
|
||||
//)
|
||||
//{
|
||||
// GLM_STATIC_ASSERT(
|
||||
@ -207,15 +207,15 @@
|
||||
// detail::type<valType>::is_int ||
|
||||
// detail::type<valType>::is_uint);
|
||||
//
|
||||
// return typename detail::tvec4<bool>::bool_type(x.x >= y.x, x.y >= y.y, x.z >= y.z, x.w >= y.w);
|
||||
// return typename tvec4<bool>::bool_type(x.x >= y.x, x.y >= y.y, x.z >= y.z, x.w >= y.w);
|
||||
//}
|
||||
//
|
||||
//// equal
|
||||
//template <typename valType>
|
||||
//GLM_FUNC_QUALIFIER typename detail::tvec2<T, P>::bool_type equal
|
||||
//GLM_FUNC_QUALIFIER typename tvec2<T, P>::bool_type equal
|
||||
//(
|
||||
// detail::tvec2<T, P> const & x,
|
||||
// detail::tvec2<T, P> const & y
|
||||
// tvec2<T, P> const & x,
|
||||
// tvec2<T, P> const & y
|
||||
//)
|
||||
//{
|
||||
// GLM_STATIC_ASSERT(
|
||||
@ -224,14 +224,14 @@
|
||||
// detail::type<valType>::is_uint ||
|
||||
// detail::type<valType>::is_bool);
|
||||
//
|
||||
// return typename detail::tvec2<T, P>::bool_type(x.x == y.x, x.y == y.y);
|
||||
// return typename tvec2<T, P>::bool_type(x.x == y.x, x.y == y.y);
|
||||
//}
|
||||
//
|
||||
//template <typename valType>
|
||||
//GLM_FUNC_QUALIFIER typename detail::tvec3<T, P>::bool_type equal
|
||||
//GLM_FUNC_QUALIFIER typename tvec3<T, P>::bool_type equal
|
||||
//(
|
||||
// detail::tvec3<T, P> const & x,
|
||||
// detail::tvec3<T, P> const & y
|
||||
// tvec3<T, P> const & x,
|
||||
// tvec3<T, P> const & y
|
||||
//)
|
||||
//{
|
||||
// GLM_STATIC_ASSERT(
|
||||
@ -240,14 +240,14 @@
|
||||
// detail::type<valType>::is_uint ||
|
||||
// detail::type<valType>::is_bool);
|
||||
//
|
||||
// return typename detail::tvec3<T, P>::bool_type(x.x == y.x, x.y == y.y, x.z == y.z);
|
||||
// return typename tvec3<T, P>::bool_type(x.x == y.x, x.y == y.y, x.z == y.z);
|
||||
//}
|
||||
//
|
||||
//template <typename valType>
|
||||
//GLM_FUNC_QUALIFIER typename detail::tvec4<T, P>::bool_type equal
|
||||
//GLM_FUNC_QUALIFIER typename tvec4<T, P>::bool_type equal
|
||||
//(
|
||||
// detail::tvec4<T, P> const & x,
|
||||
// detail::tvec4<T, P> const & y
|
||||
// tvec4<T, P> const & x,
|
||||
// tvec4<T, P> const & y
|
||||
//)
|
||||
//{
|
||||
// GLM_STATIC_ASSERT(
|
||||
@ -256,15 +256,15 @@
|
||||
// detail::type<valType>::is_uint ||
|
||||
// detail::type<valType>::is_bool);
|
||||
//
|
||||
// return typename detail::tvec4<T, P>::bool_type(x.x == y.x, x.y == y.y, x.z == y.z, x.w == y.w);
|
||||
// return typename tvec4<T, P>::bool_type(x.x == y.x, x.y == y.y, x.z == y.z, x.w == y.w);
|
||||
//}
|
||||
//
|
||||
//// notEqual
|
||||
//template <typename valType>
|
||||
//GLM_FUNC_QUALIFIER typename detail::tvec2<T, P>::bool_type notEqual
|
||||
//GLM_FUNC_QUALIFIER typename tvec2<T, P>::bool_type notEqual
|
||||
//(
|
||||
// detail::tvec2<T, P> const & x,
|
||||
// detail::tvec2<T, P> const & y
|
||||
// tvec2<T, P> const & x,
|
||||
// tvec2<T, P> const & y
|
||||
//)
|
||||
//{
|
||||
// GLM_STATIC_ASSERT(
|
||||
@ -273,14 +273,14 @@
|
||||
// detail::type<valType>::is_uint ||
|
||||
// detail::type<valType>::is_bool);
|
||||
//
|
||||
// return typename detail::tvec2<T, P>::bool_type(x.x != y.x, x.y != y.y);
|
||||
// return typename tvec2<T, P>::bool_type(x.x != y.x, x.y != y.y);
|
||||
//}
|
||||
//
|
||||
//template <typename valType>
|
||||
//GLM_FUNC_QUALIFIER typename detail::tvec3<T, P>::bool_type notEqual
|
||||
//GLM_FUNC_QUALIFIER typename tvec3<T, P>::bool_type notEqual
|
||||
//(
|
||||
// detail::tvec3<T, P> const & x,
|
||||
// detail::tvec3<T, P> const & y
|
||||
// tvec3<T, P> const & x,
|
||||
// tvec3<T, P> const & y
|
||||
//)
|
||||
//{
|
||||
// GLM_STATIC_ASSERT(
|
||||
@ -289,14 +289,14 @@
|
||||
// detail::type<valType>::is_uint ||
|
||||
// detail::type<valType>::is_bool);
|
||||
//
|
||||
// return typename detail::tvec3<T, P>::bool_type(x.x != y.x, x.y != y.y, x.z != y.z);
|
||||
// return typename tvec3<T, P>::bool_type(x.x != y.x, x.y != y.y, x.z != y.z);
|
||||
//}
|
||||
//
|
||||
//template <typename valType>
|
||||
//GLM_FUNC_QUALIFIER typename detail::tvec4<T, P>::bool_type notEqual
|
||||
//GLM_FUNC_QUALIFIER typename tvec4<T, P>::bool_type notEqual
|
||||
//(
|
||||
// detail::tvec4<T, P> const & x,
|
||||
// detail::tvec4<T, P> const & y
|
||||
// tvec4<T, P> const & x,
|
||||
// tvec4<T, P> const & y
|
||||
//)
|
||||
//{
|
||||
// GLM_STATIC_ASSERT(
|
||||
@ -305,62 +305,62 @@
|
||||
// detail::type<valType>::is_uint ||
|
||||
// detail::type<valType>::is_bool);
|
||||
//
|
||||
// return typename detail::tvec4<T, P>::bool_type(x.x != y.x, x.y != y.y, x.z != y.z, x.w != y.w);
|
||||
// return typename tvec4<T, P>::bool_type(x.x != y.x, x.y != y.y, x.z != y.z, x.w != y.w);
|
||||
//}
|
||||
//
|
||||
//// any
|
||||
//GLM_FUNC_QUALIFIER bool any(detail::tvec2<bool> const & x)
|
||||
//GLM_FUNC_QUALIFIER bool any(tvec2<bool> const & x)
|
||||
//{
|
||||
// return x.x || x.y;
|
||||
//}
|
||||
//
|
||||
//GLM_FUNC_QUALIFIER bool any(detail::tvec3<bool> const & x)
|
||||
//GLM_FUNC_QUALIFIER bool any(tvec3<bool> const & x)
|
||||
//{
|
||||
// return x.x || x.y || x.z;
|
||||
//}
|
||||
//
|
||||
//GLM_FUNC_QUALIFIER bool any(detail::tvec4<bool> const & x)
|
||||
//GLM_FUNC_QUALIFIER bool any(tvec4<bool> const & x)
|
||||
//{
|
||||
// return x.x || x.y || x.z || x.w;
|
||||
//}
|
||||
//
|
||||
//// all
|
||||
//GLM_FUNC_QUALIFIER bool all(const detail::tvec2<bool>& x)
|
||||
//GLM_FUNC_QUALIFIER bool all(const tvec2<bool>& x)
|
||||
//{
|
||||
// return x.x && x.y;
|
||||
//}
|
||||
//
|
||||
//GLM_FUNC_QUALIFIER bool all(const detail::tvec3<bool>& x)
|
||||
//GLM_FUNC_QUALIFIER bool all(const tvec3<bool>& x)
|
||||
//{
|
||||
// return x.x && x.y && x.z;
|
||||
//}
|
||||
//
|
||||
//GLM_FUNC_QUALIFIER bool all(const detail::tvec4<bool>& x)
|
||||
//GLM_FUNC_QUALIFIER bool all(const tvec4<bool>& x)
|
||||
//{
|
||||
// return x.x && x.y && x.z && x.w;
|
||||
//}
|
||||
//
|
||||
//// not
|
||||
//GLM_FUNC_QUALIFIER detail::tvec2<bool>::bool_type not_
|
||||
//GLM_FUNC_QUALIFIER tvec2<bool>::bool_type not_
|
||||
//(
|
||||
// detail::tvec2<bool> const & v
|
||||
// tvec2<bool> const & v
|
||||
//)
|
||||
//{
|
||||
// return detail::tvec2<bool>::bool_type(!v.x, !v.y);
|
||||
// return tvec2<bool>::bool_type(!v.x, !v.y);
|
||||
//}
|
||||
//
|
||||
//GLM_FUNC_QUALIFIER detail::tvec3<bool>::bool_type not_
|
||||
//GLM_FUNC_QUALIFIER tvec3<bool>::bool_type not_
|
||||
//(
|
||||
// detail::tvec3<bool> const & v
|
||||
// tvec3<bool> const & v
|
||||
//)
|
||||
//{
|
||||
// return detail::tvec3<bool>::bool_type(!v.x, !v.y, !v.z);
|
||||
// return tvec3<bool>::bool_type(!v.x, !v.y, !v.z);
|
||||
//}
|
||||
//
|
||||
//GLM_FUNC_QUALIFIER detail::tvec4<bool>::bool_type not_
|
||||
//GLM_FUNC_QUALIFIER tvec4<bool>::bool_type not_
|
||||
//(
|
||||
// detail::tvec4<bool> const & v
|
||||
// tvec4<bool> const & v
|
||||
//)
|
||||
//{
|
||||
// return detail::tvec4<bool>::bool_type(!v.x, !v.y, !v.z, !v.w);
|
||||
// return tvec4<bool>::bool_type(!v.x, !v.y, !v.z, !v.w);
|
||||
//}
|
||||
@ -12,6 +12,10 @@
|
||||
/// 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
|
||||
@ -21,13 +25,12 @@
|
||||
/// THE SOFTWARE.
|
||||
///
|
||||
/// @ref core
|
||||
/// @file glm/core/precision.hpp
|
||||
/// @file glm/detail/precision.hpp
|
||||
/// @date 2013-04-01 / 2013-04-01
|
||||
/// @author Christophe Riccio
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef GLM_CORE_PRECISION_INCLUDED
|
||||
#define GLM_CORE_PRECISION_INCLUDED
|
||||
#pragma once
|
||||
|
||||
namespace glm
|
||||
{
|
||||
@ -39,5 +42,3 @@ namespace glm
|
||||
defaultp = highp
|
||||
};
|
||||
}//namespace glm
|
||||
|
||||
#endif//GLM_CORE_PRECISION_INCLUDED
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -12,6 +12,10 @@
|
||||
/// 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
|
||||
@ -21,13 +25,12 @@
|
||||
/// THE SOFTWARE.
|
||||
///
|
||||
/// @ref core
|
||||
/// @file glm/core/type_float.hpp
|
||||
/// @file glm/detail/type_float.hpp
|
||||
/// @date 2008-08-22 / 2011-06-15
|
||||
/// @author Christophe Riccio
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef glm_core_type_float
|
||||
#define glm_core_type_float
|
||||
#pragma once
|
||||
|
||||
#include "setup.hpp"
|
||||
|
||||
@ -91,5 +94,3 @@ namespace detail
|
||||
/// @}
|
||||
|
||||
}//namespace glm
|
||||
|
||||
#endif//glm_core_type_float
|
||||
|
||||
@ -12,6 +12,10 @@
|
||||
/// 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
|
||||
@ -21,13 +25,12 @@
|
||||
/// THE SOFTWARE.
|
||||
///
|
||||
/// @ref core
|
||||
/// @file glm/core/type_gentype.hpp
|
||||
/// @file glm/detail/type_gentype.hpp
|
||||
/// @date 2008-10-05 / 2011-06-15
|
||||
/// @author Christophe Riccio
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef glm_core_type_gentype
|
||||
#define glm_core_type_gentype
|
||||
#pragma once
|
||||
|
||||
namespace glm
|
||||
{
|
||||
@ -219,5 +222,3 @@ namespace detail
|
||||
}//namespace glm
|
||||
|
||||
//#include "type_gentype.inl"
|
||||
|
||||
#endif//glm_core_type_gentype
|
||||
|
||||
@ -12,6 +12,10 @@
|
||||
/// 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
|
||||
@ -21,7 +25,7 @@
|
||||
/// THE SOFTWARE.
|
||||
///
|
||||
/// @ref core
|
||||
/// @file glm/core/type_gentype.inl
|
||||
/// @file glm/detail/type_gentype.inl
|
||||
/// @date 2008-10-05 / 2011-06-15
|
||||
/// @author Christophe Riccio
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@ -12,6 +12,10 @@
|
||||
/// 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
|
||||
@ -21,13 +25,12 @@
|
||||
/// THE SOFTWARE.
|
||||
///
|
||||
/// @ref core
|
||||
/// @file glm/core/type_half.hpp
|
||||
/// @file glm/detail/type_half.hpp
|
||||
/// @date 2008-08-17 / 2011-09-20
|
||||
/// @author Christophe Riccio
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef glm_core_type_half
|
||||
#define glm_core_type_half
|
||||
#pragma once
|
||||
|
||||
#include "setup.hpp"
|
||||
|
||||
@ -40,12 +43,6 @@ namespace detail
|
||||
GLM_FUNC_DECL hdata toFloat16(float const & value);
|
||||
|
||||
}//namespace detail
|
||||
|
||||
/// half-precision floating-point numbers.
|
||||
//typedef detail::hdata half;
|
||||
|
||||
}//namespace glm
|
||||
|
||||
#include "type_half.inl"
|
||||
|
||||
#endif//glm_core_type_half
|
||||
|
||||
@ -16,6 +16,10 @@
|
||||
/// 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
|
||||
@ -25,7 +29,7 @@
|
||||
/// THE SOFTWARE.
|
||||
///
|
||||
/// @ref core
|
||||
/// @file glm/core/type_half.inl
|
||||
/// @file glm/detail/type_half.inl
|
||||
/// @date 2008-08-17 / 2011-06-15
|
||||
/// @author Christophe Riccio
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
@ -38,8 +42,7 @@ namespace detail
|
||||
volatile float f = 1e10;
|
||||
|
||||
for(int i = 0; i < 10; ++i)
|
||||
f *= f; // this will overflow before
|
||||
// the forloop terminates
|
||||
f *= f; // this will overflow before the for loop terminates
|
||||
return f;
|
||||
}
|
||||
|
||||
|
||||
@ -12,6 +12,10 @@
|
||||
/// 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
|
||||
@ -21,15 +25,17 @@
|
||||
/// THE SOFTWARE.
|
||||
///
|
||||
/// @ref core
|
||||
/// @file glm/core/type_int.hpp
|
||||
/// @file glm/detail/type_int.hpp
|
||||
/// @date 2008-08-22 / 2013-03-30
|
||||
/// @author Christophe Riccio
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef glm_core_type_int
|
||||
#define glm_core_type_int
|
||||
#pragma once
|
||||
|
||||
#include "setup.hpp"
|
||||
#if GLM_HAS_MAKE_SIGNED
|
||||
# include <type_traits>
|
||||
#endif
|
||||
|
||||
#if GLM_HAS_EXTENDED_INTEGER_TYPE
|
||||
# include <cstdint>
|
||||
@ -52,15 +58,12 @@ namespace detail
|
||||
# if(defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)) // C99 detected, 64 bit types available
|
||||
typedef int64_t sint64;
|
||||
typedef uint64_t uint64;
|
||||
# elif(GLM_COMPILER & GLM_COMPILER_VC)
|
||||
# elif GLM_COMPILER & GLM_COMPILER_VC
|
||||
typedef signed __int64 sint64;
|
||||
typedef unsigned __int64 uint64;
|
||||
# elif(GLM_COMPILER & (GLM_COMPILER_GCC | GLM_COMPILER_LLVM_GCC | GLM_COMPILER_CLANG))
|
||||
# elif GLM_COMPILER & GLM_COMPILER_GCC
|
||||
__extension__ typedef signed long long sint64;
|
||||
__extension__ typedef unsigned long long uint64;
|
||||
# elif(GLM_COMPILER & GLM_COMPILER_BC)
|
||||
typedef Int64 sint64;
|
||||
typedef Uint64 uint64;
|
||||
# else//unknown compiler
|
||||
typedef signed long long sint64;
|
||||
typedef unsigned long long uint64;
|
||||
@ -84,6 +87,140 @@ namespace detail
|
||||
typedef unsigned int lowp_uint_t;
|
||||
typedef unsigned int mediump_uint_t;
|
||||
typedef unsigned int highp_uint_t;
|
||||
|
||||
# if GLM_HAS_MAKE_SIGNED
|
||||
using std::make_signed;
|
||||
using std::make_unsigned;
|
||||
|
||||
# else//GLM_HAS_MAKE_SIGNED
|
||||
template <typename genType>
|
||||
struct make_signed
|
||||
{};
|
||||
|
||||
template <>
|
||||
struct make_signed<char>
|
||||
{
|
||||
typedef char type;
|
||||
};
|
||||
|
||||
template <>
|
||||
struct make_signed<short>
|
||||
{
|
||||
typedef short type;
|
||||
};
|
||||
|
||||
template <>
|
||||
struct make_signed<int>
|
||||
{
|
||||
typedef int type;
|
||||
};
|
||||
|
||||
template <>
|
||||
struct make_signed<long>
|
||||
{
|
||||
typedef long type;
|
||||
};
|
||||
|
||||
template <>
|
||||
struct make_signed<long long>
|
||||
{
|
||||
typedef long long type;
|
||||
};
|
||||
|
||||
template <>
|
||||
struct make_signed<unsigned char>
|
||||
{
|
||||
typedef char type;
|
||||
};
|
||||
|
||||
template <>
|
||||
struct make_signed<unsigned short>
|
||||
{
|
||||
typedef short type;
|
||||
};
|
||||
|
||||
template <>
|
||||
struct make_signed<unsigned int>
|
||||
{
|
||||
typedef int type;
|
||||
};
|
||||
|
||||
template <>
|
||||
struct make_signed<unsigned long>
|
||||
{
|
||||
typedef long type;
|
||||
};
|
||||
|
||||
template <>
|
||||
struct make_signed<unsigned long long>
|
||||
{
|
||||
typedef long long type;
|
||||
};
|
||||
|
||||
template <typename genType>
|
||||
struct make_unsigned
|
||||
{};
|
||||
|
||||
template <>
|
||||
struct make_unsigned<char>
|
||||
{
|
||||
typedef unsigned char type;
|
||||
};
|
||||
|
||||
template <>
|
||||
struct make_unsigned<short>
|
||||
{
|
||||
typedef unsigned short type;
|
||||
};
|
||||
|
||||
template <>
|
||||
struct make_unsigned<int>
|
||||
{
|
||||
typedef unsigned int type;
|
||||
};
|
||||
|
||||
template <>
|
||||
struct make_unsigned<long>
|
||||
{
|
||||
typedef unsigned long type;
|
||||
};
|
||||
|
||||
template <>
|
||||
struct make_unsigned<long long>
|
||||
{
|
||||
typedef unsigned long long type;
|
||||
};
|
||||
|
||||
template <>
|
||||
struct make_unsigned<unsigned char>
|
||||
{
|
||||
typedef unsigned char type;
|
||||
};
|
||||
|
||||
template <>
|
||||
struct make_unsigned<unsigned short>
|
||||
{
|
||||
typedef unsigned short type;
|
||||
};
|
||||
|
||||
template <>
|
||||
struct make_unsigned<unsigned int>
|
||||
{
|
||||
typedef unsigned int type;
|
||||
};
|
||||
|
||||
template <>
|
||||
struct make_unsigned<unsigned long>
|
||||
{
|
||||
typedef unsigned long type;
|
||||
};
|
||||
|
||||
template <>
|
||||
struct make_unsigned<unsigned long long>
|
||||
{
|
||||
typedef unsigned long long type;
|
||||
};
|
||||
# endif//GLM_HAS_MAKE_SIGNED
|
||||
}//namespace detail
|
||||
|
||||
typedef detail::int8 int8;
|
||||
@ -187,5 +324,3 @@ namespace detail
|
||||
#endif//GLM_STATIC_ASSERT_NULL
|
||||
|
||||
}//namespace glm
|
||||
|
||||
#endif//glm_core_type_int
|
||||
|
||||
@ -12,6 +12,10 @@
|
||||
/// 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
|
||||
@ -21,19 +25,22 @@
|
||||
/// THE SOFTWARE.
|
||||
///
|
||||
/// @ref core
|
||||
/// @file glm/core/type_mat.hpp
|
||||
/// @file glm/detail/type_mat.hpp
|
||||
/// @date 2010-01-26 / 2011-06-15
|
||||
/// @author Christophe Riccio
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef glm_core_type_mat
|
||||
#define glm_core_type_mat
|
||||
#pragma once
|
||||
|
||||
#include "precision.hpp"
|
||||
|
||||
namespace glm{
|
||||
namespace detail
|
||||
{
|
||||
template <typename T, precision P, template <class, precision> class colType, template <class, precision> class rowType>
|
||||
struct outerProduct_trait{};
|
||||
}//namespace detail
|
||||
|
||||
template <typename T, precision P> struct tvec2;
|
||||
template <typename T, precision P> struct tvec3;
|
||||
template <typename T, precision P> struct tvec4;
|
||||
@ -47,13 +54,6 @@ namespace detail
|
||||
template <typename T, precision P> struct tmat4x3;
|
||||
template <typename T, precision P> struct tmat4x4;
|
||||
|
||||
template <typename T, precision P, template <class, precision> class colType, template <class, precision> class rowType>
|
||||
struct outerProduct_trait{};
|
||||
|
||||
template <template <class, precision> class matType, typename T, precision P>
|
||||
struct compute_inverse{};
|
||||
}//namespace detail
|
||||
|
||||
/// @addtogroup core_precision
|
||||
/// @{
|
||||
|
||||
@ -62,42 +62,42 @@ namespace detail
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
|
||||
typedef detail::tmat2x2<float, lowp> lowp_mat2;
|
||||
typedef tmat2x2<float, lowp> lowp_mat2;
|
||||
|
||||
/// 2 columns of 2 components matrix of medium precision floating-point numbers.
|
||||
/// There is no guarantee on the actual precision.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
|
||||
typedef detail::tmat2x2<float, mediump> mediump_mat2;
|
||||
typedef tmat2x2<float, mediump> mediump_mat2;
|
||||
|
||||
/// 2 columns of 2 components matrix of high precision floating-point numbers.
|
||||
/// There is no guarantee on the actual precision.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
|
||||
typedef detail::tmat2x2<float, highp> highp_mat2;
|
||||
typedef tmat2x2<float, highp> highp_mat2;
|
||||
|
||||
/// 2 columns of 2 components matrix of low precision floating-point numbers.
|
||||
/// There is no guarantee on the actual precision.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
|
||||
typedef detail::tmat2x2<float, lowp> lowp_mat2x2;
|
||||
typedef tmat2x2<float, lowp> lowp_mat2x2;
|
||||
|
||||
/// 2 columns of 2 components matrix of medium precision floating-point numbers.
|
||||
/// There is no guarantee on the actual precision.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
|
||||
typedef detail::tmat2x2<float, mediump> mediump_mat2x2;
|
||||
typedef tmat2x2<float, mediump> mediump_mat2x2;
|
||||
|
||||
/// 2 columns of 2 components matrix of high precision floating-point numbers.
|
||||
/// There is no guarantee on the actual precision.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
|
||||
typedef detail::tmat2x2<float, highp> highp_mat2x2;
|
||||
typedef tmat2x2<float, highp> highp_mat2x2;
|
||||
|
||||
/// @}
|
||||
|
||||
@ -109,21 +109,21 @@ namespace detail
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
|
||||
typedef detail::tmat2x3<float, lowp> lowp_mat2x3;
|
||||
typedef tmat2x3<float, lowp> lowp_mat2x3;
|
||||
|
||||
/// 2 columns of 3 components matrix of medium precision floating-point numbers.
|
||||
/// There is no guarantee on the actual precision.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
|
||||
typedef detail::tmat2x3<float, mediump> mediump_mat2x3;
|
||||
typedef tmat2x3<float, mediump> mediump_mat2x3;
|
||||
|
||||
/// 2 columns of 3 components matrix of high precision floating-point numbers.
|
||||
/// There is no guarantee on the actual precision.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
|
||||
typedef detail::tmat2x3<float, highp> highp_mat2x3;
|
||||
typedef tmat2x3<float, highp> highp_mat2x3;
|
||||
|
||||
/// @}
|
||||
|
||||
@ -135,21 +135,21 @@ namespace detail
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
|
||||
typedef detail::tmat2x4<float, lowp> lowp_mat2x4;
|
||||
typedef tmat2x4<float, lowp> lowp_mat2x4;
|
||||
|
||||
/// 2 columns of 4 components matrix of medium precision floating-point numbers.
|
||||
/// There is no guarantee on the actual precision.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
|
||||
typedef detail::tmat2x4<float, mediump> mediump_mat2x4;
|
||||
typedef tmat2x4<float, mediump> mediump_mat2x4;
|
||||
|
||||
/// 2 columns of 4 components matrix of high precision floating-point numbers.
|
||||
/// There is no guarantee on the actual precision.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
|
||||
typedef detail::tmat2x4<float, highp> highp_mat2x4;
|
||||
typedef tmat2x4<float, highp> highp_mat2x4;
|
||||
|
||||
/// @}
|
||||
|
||||
@ -161,21 +161,21 @@ namespace detail
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
|
||||
typedef detail::tmat3x2<float, lowp> lowp_mat3x2;
|
||||
typedef tmat3x2<float, lowp> lowp_mat3x2;
|
||||
|
||||
/// 3 columns of 2 components matrix of medium precision floating-point numbers.
|
||||
/// There is no guarantee on the actual precision.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
|
||||
typedef detail::tmat3x2<float, mediump> mediump_mat3x2;
|
||||
typedef tmat3x2<float, mediump> mediump_mat3x2;
|
||||
|
||||
/// 3 columns of 2 components matrix of high precision floating-point numbers.
|
||||
/// There is no guarantee on the actual precision.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
|
||||
typedef detail::tmat3x2<float, highp> highp_mat3x2;
|
||||
typedef tmat3x2<float, highp> highp_mat3x2;
|
||||
|
||||
/// @}
|
||||
|
||||
@ -187,42 +187,42 @@ namespace detail
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
|
||||
typedef detail::tmat3x3<float, lowp> lowp_mat3;
|
||||
typedef tmat3x3<float, lowp> lowp_mat3;
|
||||
|
||||
/// 3 columns of 3 components matrix of medium precision floating-point numbers.
|
||||
/// There is no guarantee on the actual precision.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
|
||||
typedef detail::tmat3x3<float, mediump> mediump_mat3;
|
||||
typedef tmat3x3<float, mediump> mediump_mat3;
|
||||
|
||||
/// 3 columns of 3 components matrix of high precision floating-point numbers.
|
||||
/// There is no guarantee on the actual precision.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
|
||||
typedef detail::tmat3x3<float, highp> highp_mat3;
|
||||
typedef tmat3x3<float, highp> highp_mat3;
|
||||
|
||||
/// 3 columns of 3 components matrix of low precision floating-point numbers.
|
||||
/// There is no guarantee on the actual precision.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
|
||||
typedef detail::tmat3x3<float, lowp> lowp_mat3x3;
|
||||
typedef tmat3x3<float, lowp> lowp_mat3x3;
|
||||
|
||||
/// 3 columns of 3 components matrix of medium precision floating-point numbers.
|
||||
/// There is no guarantee on the actual precision.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
|
||||
typedef detail::tmat3x3<float, mediump> mediump_mat3x3;
|
||||
typedef tmat3x3<float, mediump> mediump_mat3x3;
|
||||
|
||||
/// 3 columns of 3 components matrix of high precision floating-point numbers.
|
||||
/// There is no guarantee on the actual precision.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
|
||||
typedef detail::tmat3x3<float, highp> highp_mat3x3;
|
||||
typedef tmat3x3<float, highp> highp_mat3x3;
|
||||
|
||||
/// @}
|
||||
|
||||
@ -234,21 +234,21 @@ namespace detail
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
|
||||
typedef detail::tmat3x4<float, lowp> lowp_mat3x4;
|
||||
typedef tmat3x4<float, lowp> lowp_mat3x4;
|
||||
|
||||
/// 3 columns of 4 components matrix of medium precision floating-point numbers.
|
||||
/// There is no guarantee on the actual precision.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
|
||||
typedef detail::tmat3x4<float, mediump> mediump_mat3x4;
|
||||
typedef tmat3x4<float, mediump> mediump_mat3x4;
|
||||
|
||||
/// 3 columns of 4 components matrix of high precision floating-point numbers.
|
||||
/// There is no guarantee on the actual precision.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
|
||||
typedef detail::tmat3x4<float, highp> highp_mat3x4;
|
||||
typedef tmat3x4<float, highp> highp_mat3x4;
|
||||
|
||||
/// @}
|
||||
|
||||
@ -260,21 +260,21 @@ namespace detail
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
|
||||
typedef detail::tmat4x2<float, lowp> lowp_mat4x2;
|
||||
typedef tmat4x2<float, lowp> lowp_mat4x2;
|
||||
|
||||
/// 4 columns of 2 components matrix of medium precision floating-point numbers.
|
||||
/// There is no guarantee on the actual precision.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
|
||||
typedef detail::tmat4x2<float, mediump> mediump_mat4x2;
|
||||
typedef tmat4x2<float, mediump> mediump_mat4x2;
|
||||
|
||||
/// 4 columns of 2 components matrix of high precision floating-point numbers.
|
||||
/// There is no guarantee on the actual precision.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
|
||||
typedef detail::tmat4x2<float, highp> highp_mat4x2;
|
||||
typedef tmat4x2<float, highp> highp_mat4x2;
|
||||
|
||||
/// @}
|
||||
|
||||
@ -286,21 +286,21 @@ namespace detail
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
|
||||
typedef detail::tmat4x3<float, lowp> lowp_mat4x3;
|
||||
typedef tmat4x3<float, lowp> lowp_mat4x3;
|
||||
|
||||
/// 4 columns of 3 components matrix of medium precision floating-point numbers.
|
||||
/// There is no guarantee on the actual precision.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
|
||||
typedef detail::tmat4x3<float, mediump> mediump_mat4x3;
|
||||
typedef tmat4x3<float, mediump> mediump_mat4x3;
|
||||
|
||||
/// 4 columns of 3 components matrix of high precision floating-point numbers.
|
||||
/// There is no guarantee on the actual precision.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
|
||||
typedef detail::tmat4x3<float, highp> highp_mat4x3;
|
||||
typedef tmat4x3<float, highp> highp_mat4x3;
|
||||
|
||||
/// @}
|
||||
|
||||
@ -313,42 +313,42 @@ namespace detail
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
|
||||
typedef detail::tmat4x4<float, lowp> lowp_mat4;
|
||||
typedef tmat4x4<float, lowp> lowp_mat4;
|
||||
|
||||
/// 4 columns of 4 components matrix of medium precision floating-point numbers.
|
||||
/// There is no guarantee on the actual precision.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
|
||||
typedef detail::tmat4x4<float, mediump> mediump_mat4;
|
||||
typedef tmat4x4<float, mediump> mediump_mat4;
|
||||
|
||||
/// 4 columns of 4 components matrix of high precision floating-point numbers.
|
||||
/// There is no guarantee on the actual precision.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
|
||||
typedef detail::tmat4x4<float, highp> highp_mat4;
|
||||
typedef tmat4x4<float, highp> highp_mat4;
|
||||
|
||||
/// 4 columns of 4 components matrix of low precision floating-point numbers.
|
||||
/// There is no guarantee on the actual precision.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
|
||||
typedef detail::tmat4x4<float, lowp> lowp_mat4x4;
|
||||
typedef tmat4x4<float, lowp> lowp_mat4x4;
|
||||
|
||||
/// 4 columns of 4 components matrix of medium precision floating-point numbers.
|
||||
/// There is no guarantee on the actual precision.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
|
||||
typedef detail::tmat4x4<float, mediump> mediump_mat4x4;
|
||||
typedef tmat4x4<float, mediump> mediump_mat4x4;
|
||||
|
||||
/// 4 columns of 4 components matrix of high precision floating-point numbers.
|
||||
/// There is no guarantee on the actual precision.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
|
||||
typedef detail::tmat4x4<float, highp> highp_mat4x4;
|
||||
typedef tmat4x4<float, highp> highp_mat4x4;
|
||||
|
||||
/// @}
|
||||
|
||||
@ -451,37 +451,37 @@ namespace detail
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
|
||||
typedef detail::tmat2x2<double, lowp> lowp_dmat2;
|
||||
typedef tmat2x2<double, lowp> lowp_dmat2;
|
||||
|
||||
/// 2 columns of 2 components matrix of medium precision floating-point numbers.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
|
||||
typedef detail::tmat2x2<double, mediump> mediump_dmat2;
|
||||
typedef tmat2x2<double, mediump> mediump_dmat2;
|
||||
|
||||
/// 2 columns of 2 components matrix of high precision floating-point numbers.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
|
||||
typedef detail::tmat2x2<double, highp> highp_dmat2;
|
||||
typedef tmat2x2<double, highp> highp_dmat2;
|
||||
|
||||
/// 2 columns of 2 components matrix of low precision floating-point numbers.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
|
||||
typedef detail::tmat2x2<double, lowp> lowp_dmat2x2;
|
||||
typedef tmat2x2<double, lowp> lowp_dmat2x2;
|
||||
|
||||
/// 2 columns of 2 components matrix of medium precision floating-point numbers.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
|
||||
typedef detail::tmat2x2<double, mediump> mediump_dmat2x2;
|
||||
typedef tmat2x2<double, mediump> mediump_dmat2x2;
|
||||
|
||||
/// 2 columns of 2 components matrix of high precision floating-point numbers.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
|
||||
typedef detail::tmat2x2<double, highp> highp_dmat2x2;
|
||||
typedef tmat2x2<double, highp> highp_dmat2x2;
|
||||
|
||||
/// @}
|
||||
|
||||
@ -492,19 +492,19 @@ namespace detail
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
|
||||
typedef detail::tmat2x3<double, lowp> lowp_dmat2x3;
|
||||
typedef tmat2x3<double, lowp> lowp_dmat2x3;
|
||||
|
||||
/// 2 columns of 3 components matrix of medium precision floating-point numbers.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
|
||||
typedef detail::tmat2x3<double, mediump> mediump_dmat2x3;
|
||||
typedef tmat2x3<double, mediump> mediump_dmat2x3;
|
||||
|
||||
/// 2 columns of 3 components matrix of high precision floating-point numbers.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
|
||||
typedef detail::tmat2x3<double, highp> highp_dmat2x3;
|
||||
typedef tmat2x3<double, highp> highp_dmat2x3;
|
||||
|
||||
/// @}
|
||||
|
||||
@ -515,19 +515,19 @@ namespace detail
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
|
||||
typedef detail::tmat2x4<double, lowp> lowp_dmat2x4;
|
||||
typedef tmat2x4<double, lowp> lowp_dmat2x4;
|
||||
|
||||
/// 2 columns of 4 components matrix of medium precision floating-point numbers.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
|
||||
typedef detail::tmat2x4<double, mediump> mediump_dmat2x4;
|
||||
typedef tmat2x4<double, mediump> mediump_dmat2x4;
|
||||
|
||||
/// 2 columns of 4 components matrix of high precision floating-point numbers.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
|
||||
typedef detail::tmat2x4<double, highp> highp_dmat2x4;
|
||||
typedef tmat2x4<double, highp> highp_dmat2x4;
|
||||
|
||||
/// @}
|
||||
|
||||
@ -538,19 +538,19 @@ namespace detail
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
|
||||
typedef detail::tmat3x2<double, lowp> lowp_dmat3x2;
|
||||
typedef tmat3x2<double, lowp> lowp_dmat3x2;
|
||||
|
||||
/// 3 columns of 2 components matrix of medium precision floating-point numbers.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
|
||||
typedef detail::tmat3x2<double, mediump> mediump_dmat3x2;
|
||||
typedef tmat3x2<double, mediump> mediump_dmat3x2;
|
||||
|
||||
/// 3 columns of 2 components matrix of high precision floating-point numbers.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
|
||||
typedef detail::tmat3x2<double, highp> highp_dmat3x2;
|
||||
typedef tmat3x2<double, highp> highp_dmat3x2;
|
||||
|
||||
/// @}
|
||||
|
||||
@ -561,37 +561,37 @@ namespace detail
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
|
||||
typedef detail::tmat3x3<float, lowp> lowp_dmat3;
|
||||
typedef tmat3x3<float, lowp> lowp_dmat3;
|
||||
|
||||
/// 3 columns of 3 components matrix of medium precision floating-point numbers.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
|
||||
typedef detail::tmat3x3<double, mediump> mediump_dmat3;
|
||||
typedef tmat3x3<double, mediump> mediump_dmat3;
|
||||
|
||||
/// 3 columns of 3 components matrix of high precision floating-point numbers.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
|
||||
typedef detail::tmat3x3<double, highp> highp_dmat3;
|
||||
typedef tmat3x3<double, highp> highp_dmat3;
|
||||
|
||||
/// 3 columns of 3 components matrix of low precision floating-point numbers.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
|
||||
typedef detail::tmat3x3<double, lowp> lowp_dmat3x3;
|
||||
typedef tmat3x3<double, lowp> lowp_dmat3x3;
|
||||
|
||||
/// 3 columns of 3 components matrix of medium precision floating-point numbers.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
|
||||
typedef detail::tmat3x3<double, mediump> mediump_dmat3x3;
|
||||
typedef tmat3x3<double, mediump> mediump_dmat3x3;
|
||||
|
||||
/// 3 columns of 3 components matrix of high precision floating-point numbers.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
|
||||
typedef detail::tmat3x3<double, highp> highp_dmat3x3;
|
||||
typedef tmat3x3<double, highp> highp_dmat3x3;
|
||||
|
||||
/// @}
|
||||
|
||||
@ -602,19 +602,19 @@ namespace detail
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
|
||||
typedef detail::tmat3x4<double, lowp> lowp_dmat3x4;
|
||||
typedef tmat3x4<double, lowp> lowp_dmat3x4;
|
||||
|
||||
/// 3 columns of 4 components matrix of medium precision floating-point numbers.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
|
||||
typedef detail::tmat3x4<double, mediump> mediump_dmat3x4;
|
||||
typedef tmat3x4<double, mediump> mediump_dmat3x4;
|
||||
|
||||
/// 3 columns of 4 components matrix of high precision floating-point numbers.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
|
||||
typedef detail::tmat3x4<double, highp> highp_dmat3x4;
|
||||
typedef tmat3x4<double, highp> highp_dmat3x4;
|
||||
|
||||
/// @}
|
||||
|
||||
@ -625,19 +625,19 @@ namespace detail
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
|
||||
typedef detail::tmat4x2<double, lowp> lowp_dmat4x2;
|
||||
typedef tmat4x2<double, lowp> lowp_dmat4x2;
|
||||
|
||||
/// 4 columns of 2 components matrix of medium precision floating-point numbers.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
|
||||
typedef detail::tmat4x2<double, mediump> mediump_dmat4x2;
|
||||
typedef tmat4x2<double, mediump> mediump_dmat4x2;
|
||||
|
||||
/// 4 columns of 2 components matrix of high precision floating-point numbers.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
|
||||
typedef detail::tmat4x2<double, highp> highp_dmat4x2;
|
||||
typedef tmat4x2<double, highp> highp_dmat4x2;
|
||||
|
||||
/// @}
|
||||
|
||||
@ -648,19 +648,19 @@ namespace detail
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
|
||||
typedef detail::tmat4x3<double, lowp> lowp_dmat4x3;
|
||||
typedef tmat4x3<double, lowp> lowp_dmat4x3;
|
||||
|
||||
/// 4 columns of 3 components matrix of medium precision floating-point numbers.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
|
||||
typedef detail::tmat4x3<double, mediump> mediump_dmat4x3;
|
||||
typedef tmat4x3<double, mediump> mediump_dmat4x3;
|
||||
|
||||
/// 4 columns of 3 components matrix of high precision floating-point numbers.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
|
||||
typedef detail::tmat4x3<double, highp> highp_dmat4x3;
|
||||
typedef tmat4x3<double, highp> highp_dmat4x3;
|
||||
|
||||
/// @}
|
||||
|
||||
@ -671,37 +671,37 @@ namespace detail
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
|
||||
typedef detail::tmat4x4<double, lowp> lowp_dmat4;
|
||||
typedef tmat4x4<double, lowp> lowp_dmat4;
|
||||
|
||||
/// 4 columns of 4 components matrix of medium precision floating-point numbers.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
|
||||
typedef detail::tmat4x4<double, mediump> mediump_dmat4;
|
||||
typedef tmat4x4<double, mediump> mediump_dmat4;
|
||||
|
||||
/// 4 columns of 4 components matrix of high precision floating-point numbers.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
|
||||
typedef detail::tmat4x4<double, highp> highp_dmat4;
|
||||
typedef tmat4x4<double, highp> highp_dmat4;
|
||||
|
||||
/// 4 columns of 4 components matrix of low precision floating-point numbers.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
|
||||
typedef detail::tmat4x4<double, lowp> lowp_dmat4x4;
|
||||
typedef tmat4x4<double, lowp> lowp_dmat4x4;
|
||||
|
||||
/// 4 columns of 4 components matrix of medium precision floating-point numbers.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
|
||||
typedef detail::tmat4x4<double, mediump> mediump_dmat4x4;
|
||||
typedef tmat4x4<double, mediump> mediump_dmat4x4;
|
||||
|
||||
/// 4 columns of 4 components matrix of high precision floating-point numbers.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
|
||||
typedef detail::tmat4x4<double, highp> highp_dmat4x4;
|
||||
typedef tmat4x4<double, highp> highp_dmat4x4;
|
||||
|
||||
/// @}
|
||||
|
||||
@ -791,5 +791,3 @@ namespace detail
|
||||
|
||||
/// @}
|
||||
}//namespace glm
|
||||
|
||||
#endif//glm_core_type_mat
|
||||
|
||||
@ -12,6 +12,10 @@
|
||||
/// 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
|
||||
@ -21,7 +25,8 @@
|
||||
/// THE SOFTWARE.
|
||||
///
|
||||
/// @ref core
|
||||
/// @file glm/core/type_mat.inl
|
||||
/// @file glm/detail/type_mat.inl
|
||||
/// @date 2011-06-15 / 2011-06-15
|
||||
/// @author Christophe Riccio
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
@ -12,6 +12,10 @@
|
||||
/// 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
|
||||
@ -20,35 +24,30 @@
|
||||
/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
/// THE SOFTWARE.
|
||||
///
|
||||
/// @ref core
|
||||
/// @file glm/core/type_mat2x2.hpp
|
||||
/// @ref core
|
||||
/// @file glm/detail/type_mat2x2.hpp
|
||||
/// @date 2005-01-27 / 2011-06-15
|
||||
/// @author Christophe Riccio
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef glm_core_type_mat2x2
|
||||
#define glm_core_type_mat2x2
|
||||
#pragma once
|
||||
|
||||
#include "../fwd.hpp"
|
||||
#include "type_vec2.hpp"
|
||||
#include "type_mat.hpp"
|
||||
#include <limits>
|
||||
#include <cstddef>
|
||||
|
||||
namespace glm{
|
||||
namespace detail
|
||||
namespace glm
|
||||
{
|
||||
template <typename T, precision P>
|
||||
template <typename T, precision P = defaultp>
|
||||
struct tmat2x2
|
||||
{
|
||||
enum ctor{_null};
|
||||
typedef T value_type;
|
||||
typedef std::size_t size_type;
|
||||
typedef tvec2<T, P> col_type;
|
||||
typedef tvec2<T, P> row_type;
|
||||
typedef tmat2x2<T, P> type;
|
||||
typedef tmat2x2<T, P> transpose_type;
|
||||
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const;
|
||||
typedef T value_type;
|
||||
|
||||
template <typename U, precision Q>
|
||||
friend tvec2<U, Q> operator/(tmat2x2<U, Q> const & m, tvec2<U, Q> const & v);
|
||||
@ -64,14 +63,11 @@ namespace detail
|
||||
//////////////////////////////////////
|
||||
// Constructors
|
||||
GLM_FUNC_DECL tmat2x2();
|
||||
GLM_FUNC_DECL tmat2x2(tmat2x2<T, P> const & m);
|
||||
template <precision Q>
|
||||
GLM_FUNC_DECL tmat2x2(tmat2x2<T, Q> const & m);
|
||||
|
||||
GLM_FUNC_DECL explicit tmat2x2(
|
||||
ctor Null);
|
||||
GLM_FUNC_DECL explicit tmat2x2(
|
||||
T const & x);
|
||||
GLM_FUNC_DECL explicit tmat2x2(ctor);
|
||||
GLM_FUNC_DECL explicit tmat2x2(T const & x);
|
||||
GLM_FUNC_DECL tmat2x2(
|
||||
T const & x1, T const & y1,
|
||||
T const & x2, T const & y2);
|
||||
@ -93,8 +89,14 @@ namespace detail
|
||||
|
||||
//////////////////////////////////////
|
||||
// Matrix conversions
|
||||
template <typename U, precision Q>
|
||||
GLM_FUNC_DECL explicit tmat2x2(tmat2x2<U, Q> const & m);
|
||||
|
||||
# ifdef GLM_FORCE_EXPLICIT_CTOR
|
||||
template <typename U, precision Q>
|
||||
GLM_FUNC_DECL explicit tmat2x2(tmat2x2<U, Q> const & m);
|
||||
# else
|
||||
template <typename U, precision Q>
|
||||
GLM_FUNC_DECL tmat2x2(tmat2x2<U, Q> const & m);
|
||||
# endif
|
||||
|
||||
GLM_FUNC_DECL explicit tmat2x2(tmat3x3<T, P> const & x);
|
||||
GLM_FUNC_DECL explicit tmat2x2(tmat4x4<T, P> const & x);
|
||||
@ -108,11 +110,23 @@ namespace detail
|
||||
//////////////////////////////////////
|
||||
// Accesses
|
||||
|
||||
GLM_FUNC_DECL col_type & operator[](length_t i);
|
||||
GLM_FUNC_DECL col_type const & operator[](length_t i) const;
|
||||
# ifdef GLM_FORCE_SIZE_FUNC
|
||||
typedef size_t size_type;
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR size_t size() const;
|
||||
|
||||
GLM_FUNC_DECL col_type & operator[](size_type i);
|
||||
GLM_FUNC_DECL col_type const & operator[](size_type i) const;
|
||||
# else
|
||||
typedef length_t length_type;
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR length_type length() const;
|
||||
|
||||
GLM_FUNC_DECL col_type & operator[](length_type i);
|
||||
GLM_FUNC_DECL col_type const & operator[](length_type i) const;
|
||||
# endif//GLM_FORCE_SIZE_FUNC
|
||||
|
||||
//////////////////////////////////////
|
||||
// Unary arithmetic operators
|
||||
|
||||
// Unary updatable operators
|
||||
GLM_FUNC_DECL tmat2x2<T, P> & operator=(tmat2x2<T, P> const & m);
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tmat2x2<T, P> & operator=(tmat2x2<U, P> const & m);
|
||||
template <typename U>
|
||||
@ -141,109 +155,66 @@ namespace detail
|
||||
GLM_FUNC_DECL tmat2x2<T, P> operator--(int);
|
||||
};
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tmat2x2<T, P> compute_inverse_mat2(tmat2x2<T, P> const & m);
|
||||
|
||||
// Binary operators
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tmat2x2<T, P> operator+ (
|
||||
tmat2x2<T, P> const & m,
|
||||
T const & s);
|
||||
GLM_FUNC_DECL tmat2x2<T, P> operator+(tmat2x2<T, P> const & m, T const & s);
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tmat2x2<T, P> operator+ (
|
||||
T const & s,
|
||||
tmat2x2<T, P> const & m);
|
||||
GLM_FUNC_DECL tmat2x2<T, P> operator+(T const & s, tmat2x2<T, P> const & m);
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tmat2x2<T, P> operator+ (
|
||||
tmat2x2<T, P> const & m1,
|
||||
tmat2x2<T, P> const & m2);
|
||||
GLM_FUNC_DECL tmat2x2<T, P> operator+(tmat2x2<T, P> const & m1, tmat2x2<T, P> const & m2);
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tmat2x2<T, P> operator- (
|
||||
tmat2x2<T, P> const & m,
|
||||
T const & s);
|
||||
GLM_FUNC_DECL tmat2x2<T, P> operator-(tmat2x2<T, P> const & m, T const & s);
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tmat2x2<T, P> operator- (
|
||||
T const & s,
|
||||
tmat2x2<T, P> const & m);
|
||||
GLM_FUNC_DECL tmat2x2<T, P> operator-(T const & s, tmat2x2<T, P> const & m);
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tmat2x2<T, P> operator- (
|
||||
tmat2x2<T, P> const & m1,
|
||||
tmat2x2<T, P> const & m2);
|
||||
GLM_FUNC_DECL tmat2x2<T, P> operator-(tmat2x2<T, P> const & m1, tmat2x2<T, P> const & m2);
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tmat2x2<T, P> operator* (
|
||||
tmat2x2<T, P> const & m,
|
||||
T const & s);
|
||||
GLM_FUNC_DECL tmat2x2<T, P> operator*(tmat2x2<T, P> const & m, T const & s);
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tmat2x2<T, P> operator* (
|
||||
T const & s,
|
||||
tmat2x2<T, P> const & m);
|
||||
GLM_FUNC_DECL tmat2x2<T, P> operator*(T const & s, tmat2x2<T, P> const & m);
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL typename tmat2x2<T, P>::col_type operator* (
|
||||
tmat2x2<T, P> const & m,
|
||||
typename tmat2x2<T, P>::row_type const & v);
|
||||
GLM_FUNC_DECL typename tmat2x2<T, P>::col_type operator*(tmat2x2<T, P> const & m, typename tmat2x2<T, P>::row_type const & v);
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL typename tmat2x2<T, P>::row_type operator* (
|
||||
typename tmat2x2<T, P>::col_type const & v,
|
||||
tmat2x2<T, P> const & m);
|
||||
GLM_FUNC_DECL typename tmat2x2<T, P>::row_type operator*(typename tmat2x2<T, P>::col_type const & v, tmat2x2<T, P> const & m);
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tmat2x2<T, P> operator* (
|
||||
tmat2x2<T, P> const & m1,
|
||||
tmat2x2<T, P> const & m2);
|
||||
GLM_FUNC_DECL tmat2x2<T, P> operator*(tmat2x2<T, P> const & m1, tmat2x2<T, P> const & m2);
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tmat3x2<T, P> operator* (
|
||||
tmat2x2<T, P> const & m1,
|
||||
tmat3x2<T, P> const & m2);
|
||||
GLM_FUNC_DECL tmat3x2<T, P> operator*(tmat2x2<T, P> const & m1, tmat3x2<T, P> const & m2);
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tmat4x2<T, P> operator* (
|
||||
tmat2x2<T, P> const & m1,
|
||||
tmat4x2<T, P> const & m2);
|
||||
GLM_FUNC_DECL tmat4x2<T, P> operator*(tmat2x2<T, P> const & m1, tmat4x2<T, P> const & m2);
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tmat2x2<T, P> operator/ (
|
||||
tmat2x2<T, P> const & m,
|
||||
T const & s);
|
||||
GLM_FUNC_DECL tmat2x2<T, P> operator/(tmat2x2<T, P> const & m, T const & s);
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tmat2x2<T, P> operator/ (
|
||||
T const & s,
|
||||
tmat2x2<T, P> const & m);
|
||||
GLM_FUNC_DECL tmat2x2<T, P> operator/(T const & s, tmat2x2<T, P> const & m);
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL typename tmat2x2<T, P>::col_type operator/ (
|
||||
tmat2x2<T, P> const & m,
|
||||
typename tmat2x2<T, P>::row_type const & v);
|
||||
GLM_FUNC_DECL typename tmat2x2<T, P>::col_type operator/(tmat2x2<T, P> const & m, typename tmat2x2<T, P>::row_type const & v);
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL typename tmat2x2<T, P>::row_type operator/ (
|
||||
typename tmat2x2<T, P>::col_type const & v,
|
||||
tmat2x2<T, P> const & m);
|
||||
GLM_FUNC_DECL typename tmat2x2<T, P>::row_type operator/(typename tmat2x2<T, P>::col_type const & v, tmat2x2<T, P> const & m);
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tmat2x2<T, P> operator/ (
|
||||
tmat2x2<T, P> const & m1,
|
||||
tmat2x2<T, P> const & m2);
|
||||
GLM_FUNC_DECL tmat2x2<T, P> operator/(tmat2x2<T, P> const & m1, tmat2x2<T, P> const & m2);
|
||||
|
||||
// Unary constant operators
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tmat2x2<T, P> const operator-(
|
||||
tmat2x2<T, P> const & m);
|
||||
} //namespace detail
|
||||
GLM_FUNC_DECL tmat2x2<T, P> const operator-(tmat2x2<T, P> const & m);
|
||||
} //namespace glm
|
||||
|
||||
#ifndef GLM_EXTERNAL_TEMPLATE
|
||||
#include "type_mat2x2.inl"
|
||||
#endif
|
||||
|
||||
#endif //glm_core_type_mat2x2
|
||||
|
||||
@ -12,6 +12,10 @@
|
||||
/// 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
|
||||
@ -21,7 +25,7 @@
|
||||
/// THE SOFTWARE.
|
||||
///
|
||||
/// @ref core
|
||||
/// @file glm/core/type_mat2x2.inl
|
||||
/// @file glm/detail/type_mat2x2.inl
|
||||
/// @date 2005-01-16 / 2011-06-15
|
||||
/// @author Christophe Riccio
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
@ -30,35 +34,21 @@ namespace glm{
|
||||
namespace detail
|
||||
{
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR length_t tmat2x2<T, P>::length() const
|
||||
GLM_FUNC_QUALIFIER tmat2x2<T, P> compute_inverse(tmat2x2<T, P> const & m)
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
T OneOverDeterminant = static_cast<T>(1) / (
|
||||
+ m[0][0] * m[1][1]
|
||||
- m[1][0] * m[0][1]);
|
||||
|
||||
//////////////////////////////////////
|
||||
// Accesses
|
||||
tmat2x2<T, P> Inverse(
|
||||
+ m[1][1] * OneOverDeterminant,
|
||||
- m[0][1] * OneOverDeterminant,
|
||||
- m[1][0] * OneOverDeterminant,
|
||||
+ m[0][0] * OneOverDeterminant);
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER typename tmat2x2<T, P>::col_type &
|
||||
tmat2x2<T, P>::operator[]
|
||||
(
|
||||
length_t i
|
||||
)
|
||||
{
|
||||
assert(i < this->length());
|
||||
return this->value[i];
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER typename tmat2x2<T, P>::col_type const &
|
||||
tmat2x2<T, P>::operator[]
|
||||
(
|
||||
length_t i
|
||||
) const
|
||||
{
|
||||
assert(i < this->length());
|
||||
return this->value[i];
|
||||
return Inverse;
|
||||
}
|
||||
}//namespace detail
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
// Constructors
|
||||
@ -66,45 +56,29 @@ namespace detail
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat2x2<T, P>::tmat2x2()
|
||||
{
|
||||
this->value[0] = col_type(1, 0);
|
||||
this->value[1] = col_type(0, 1);
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat2x2<T, P>::tmat2x2
|
||||
(
|
||||
tmat2x2<T, P> const & m
|
||||
)
|
||||
{
|
||||
this->value[0] = m.value[0];
|
||||
this->value[1] = m.value[1];
|
||||
# ifndef GLM_FORCE_NO_CTOR_INIT
|
||||
this->value[0] = col_type(1, 0);
|
||||
this->value[1] = col_type(0, 1);
|
||||
# endif
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
template <precision Q>
|
||||
GLM_FUNC_QUALIFIER tmat2x2<T, P>::tmat2x2(
|
||||
tmat2x2<T, Q> const & m)
|
||||
GLM_FUNC_QUALIFIER tmat2x2<T, P>::tmat2x2(tmat2x2<T, Q> const & m)
|
||||
{
|
||||
this->value[0] = m.value[0];
|
||||
this->value[1] = m.value[1];
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat2x2<T, P>::tmat2x2
|
||||
(
|
||||
ctor
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat2x2<T, P>::tmat2x2(ctor)
|
||||
{}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat2x2<T, P>::tmat2x2
|
||||
(
|
||||
T const & s
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat2x2<T, P>::tmat2x2(T const & s)
|
||||
{
|
||||
value_type const Zero(0);
|
||||
this->value[0] = col_type(s, Zero);
|
||||
this->value[1] = col_type(Zero, s);
|
||||
this->value[0] = col_type(s, 0);
|
||||
this->value[1] = col_type(0, s);
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
@ -119,11 +93,7 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat2x2<T, P>::tmat2x2
|
||||
(
|
||||
col_type const & v0,
|
||||
col_type const & v1
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat2x2<T, P>::tmat2x2(col_type const & v0, col_type const & v1)
|
||||
{
|
||||
this->value[0] = v0;
|
||||
this->value[1] = v1;
|
||||
@ -145,11 +115,7 @@ namespace detail
|
||||
|
||||
template <typename T, precision P>
|
||||
template <typename V1, typename V2>
|
||||
GLM_FUNC_QUALIFIER tmat2x2<T, P>::tmat2x2
|
||||
(
|
||||
tvec2<V1, P> const & v1,
|
||||
tvec2<V2, P> const & v2
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat2x2<T, P>::tmat2x2(tvec2<V1, P> const & v1, tvec2<V2, P> const & v2)
|
||||
{
|
||||
this->value[0] = col_type(v1);
|
||||
this->value[1] = col_type(v2);
|
||||
@ -160,101 +126,119 @@ namespace detail
|
||||
|
||||
template <typename T, precision P>
|
||||
template <typename U, precision Q>
|
||||
GLM_FUNC_QUALIFIER tmat2x2<T, P>::tmat2x2
|
||||
(
|
||||
tmat2x2<U, Q> const & m
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat2x2<T, P>::tmat2x2(tmat2x2<U, Q> const & m)
|
||||
{
|
||||
this->value[0] = col_type(m[0]);
|
||||
this->value[1] = col_type(m[1]);
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat2x2<T, P>::tmat2x2
|
||||
(
|
||||
tmat3x3<T, P> const & m
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat2x2<T, P>::tmat2x2(tmat3x3<T, P> const & m)
|
||||
{
|
||||
this->value[0] = col_type(m[0]);
|
||||
this->value[1] = col_type(m[1]);
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat2x2<T, P>::tmat2x2
|
||||
(
|
||||
tmat4x4<T, P> const & m
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat2x2<T, P>::tmat2x2(tmat4x4<T, P> const & m)
|
||||
{
|
||||
this->value[0] = col_type(m[0]);
|
||||
this->value[1] = col_type(m[1]);
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat2x2<T, P>::tmat2x2
|
||||
(
|
||||
tmat2x3<T, P> const & m
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat2x2<T, P>::tmat2x2(tmat2x3<T, P> const & m)
|
||||
{
|
||||
this->value[0] = col_type(m[0]);
|
||||
this->value[1] = col_type(m[1]);
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat2x2<T, P>::tmat2x2
|
||||
(
|
||||
tmat3x2<T, P> const & m
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat2x2<T, P>::tmat2x2(tmat3x2<T, P> const & m)
|
||||
{
|
||||
this->value[0] = m[0];
|
||||
this->value[1] = m[1];
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat2x2<T, P>::tmat2x2
|
||||
(
|
||||
tmat2x4<T, P> const & m
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat2x2<T, P>::tmat2x2(tmat2x4<T, P> const & m)
|
||||
{
|
||||
this->value[0] = col_type(m[0]);
|
||||
this->value[1] = col_type(m[1]);
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat2x2<T, P>::tmat2x2
|
||||
(
|
||||
tmat4x2<T, P> const & m
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat2x2<T, P>::tmat2x2(tmat4x2<T, P> const & m)
|
||||
{
|
||||
this->value[0] = m[0];
|
||||
this->value[1] = m[1];
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat2x2<T, P>::tmat2x2
|
||||
(
|
||||
tmat3x4<T, P> const & m
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat2x2<T, P>::tmat2x2(tmat3x4<T, P> const & m)
|
||||
{
|
||||
this->value[0] = col_type(m[0]);
|
||||
this->value[1] = col_type(m[1]);
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat2x2<T, P>::tmat2x2
|
||||
(
|
||||
tmat4x3<T, P> const & m
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat2x2<T, P>::tmat2x2(tmat4x3<T, P> const & m)
|
||||
{
|
||||
this->value[0] = col_type(m[0]);
|
||||
this->value[1] = col_type(m[1]);
|
||||
}
|
||||
|
||||
//////////////////////////////////////
|
||||
// Accesses
|
||||
|
||||
# ifdef GLM_FORCE_SIZE_FUNC
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tmat2x2<T, P>::size_type tmat2x2<T, P>::size() const
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER typename tmat2x2<T, P>::col_type & tmat2x2<T, P>::operator[](typename tmat2x2<T, P>::size_type i)
|
||||
{
|
||||
assert(i < this->size());
|
||||
return this->value[i];
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER typename tmat2x2<T, P>::col_type const & tmat2x2<T, P>::operator[](typename tmat2x2<T, P>::size_type i) const
|
||||
{
|
||||
assert(i < this->size());
|
||||
return this->value[i];
|
||||
}
|
||||
# else
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tmat2x2<T, P>::length_type tmat2x2<T, P>::length() const
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER typename tmat2x2<T, P>::col_type & tmat2x2<T, P>::operator[](typename tmat2x2<T, P>::length_type i)
|
||||
{
|
||||
assert(i < this->length());
|
||||
return this->value[i];
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER typename tmat2x2<T, P>::col_type const & tmat2x2<T, P>::operator[](typename tmat2x2<T, P>::length_type i) const
|
||||
{
|
||||
assert(i < this->length());
|
||||
return this->value[i];
|
||||
}
|
||||
# endif//GLM_FORCE_SIZE_FUNC
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
// mat2x2 operators
|
||||
// Unary updatable operators
|
||||
|
||||
// This function shouldn't required but it seems that VC7.1 have an optimisation bug if this operator wasn't declared
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat2x2<T, P>& tmat2x2<T, P>::operator= (tmat2x2<T, P> const & m)
|
||||
template <typename U>
|
||||
GLM_FUNC_QUALIFIER tmat2x2<T, P>& tmat2x2<T, P>::operator=(tmat2x2<U, P> const & m)
|
||||
{
|
||||
this->value[0] = m[0];
|
||||
this->value[1] = m[1];
|
||||
@ -263,16 +247,7 @@ namespace detail
|
||||
|
||||
template <typename T, precision P>
|
||||
template <typename U>
|
||||
GLM_FUNC_QUALIFIER tmat2x2<T, P>& tmat2x2<T, P>::operator= (tmat2x2<U, P> const & m)
|
||||
{
|
||||
this->value[0] = m[0];
|
||||
this->value[1] = m[1];
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
template <typename U>
|
||||
GLM_FUNC_QUALIFIER tmat2x2<T, P>& tmat2x2<T, P>::operator+= (U s)
|
||||
GLM_FUNC_QUALIFIER tmat2x2<T, P>& tmat2x2<T, P>::operator+=(U s)
|
||||
{
|
||||
this->value[0] += s;
|
||||
this->value[1] += s;
|
||||
@ -281,7 +256,7 @@ namespace detail
|
||||
|
||||
template <typename T, precision P>
|
||||
template <typename U>
|
||||
GLM_FUNC_QUALIFIER tmat2x2<T, P>& tmat2x2<T, P>::operator+= (tmat2x2<U, P> const & m)
|
||||
GLM_FUNC_QUALIFIER tmat2x2<T, P>& tmat2x2<T, P>::operator+=(tmat2x2<U, P> const & m)
|
||||
{
|
||||
this->value[0] += m[0];
|
||||
this->value[1] += m[1];
|
||||
@ -290,7 +265,7 @@ namespace detail
|
||||
|
||||
template <typename T, precision P>
|
||||
template <typename U>
|
||||
GLM_FUNC_QUALIFIER tmat2x2<T, P>& tmat2x2<T, P>::operator-= (U s)
|
||||
GLM_FUNC_QUALIFIER tmat2x2<T, P>& tmat2x2<T, P>::operator-=(U s)
|
||||
{
|
||||
this->value[0] -= s;
|
||||
this->value[1] -= s;
|
||||
@ -299,7 +274,7 @@ namespace detail
|
||||
|
||||
template <typename T, precision P>
|
||||
template <typename U>
|
||||
GLM_FUNC_QUALIFIER tmat2x2<T, P>& tmat2x2<T, P>::operator-= (tmat2x2<U, P> const & m)
|
||||
GLM_FUNC_QUALIFIER tmat2x2<T, P>& tmat2x2<T, P>::operator-=(tmat2x2<U, P> const & m)
|
||||
{
|
||||
this->value[0] -= m[0];
|
||||
this->value[1] -= m[1];
|
||||
@ -308,7 +283,7 @@ namespace detail
|
||||
|
||||
template <typename T, precision P>
|
||||
template <typename U>
|
||||
GLM_FUNC_QUALIFIER tmat2x2<T, P>& tmat2x2<T, P>::operator*= (U s)
|
||||
GLM_FUNC_QUALIFIER tmat2x2<T, P>& tmat2x2<T, P>::operator*=(U s)
|
||||
{
|
||||
this->value[0] *= s;
|
||||
this->value[1] *= s;
|
||||
@ -317,14 +292,14 @@ namespace detail
|
||||
|
||||
template <typename T, precision P>
|
||||
template <typename U>
|
||||
GLM_FUNC_QUALIFIER tmat2x2<T, P>& tmat2x2<T, P>::operator*= (tmat2x2<U, P> const & m)
|
||||
GLM_FUNC_QUALIFIER tmat2x2<T, P>& tmat2x2<T, P>::operator*=(tmat2x2<U, P> const & m)
|
||||
{
|
||||
return (*this = *this * m);
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
template <typename U>
|
||||
GLM_FUNC_QUALIFIER tmat2x2<T, P>& tmat2x2<T, P>::operator/= (U s)
|
||||
GLM_FUNC_QUALIFIER tmat2x2<T, P>& tmat2x2<T, P>::operator/=(U s)
|
||||
{
|
||||
this->value[0] /= s;
|
||||
this->value[1] /= s;
|
||||
@ -333,9 +308,9 @@ namespace detail
|
||||
|
||||
template <typename T, precision P>
|
||||
template <typename U>
|
||||
GLM_FUNC_QUALIFIER tmat2x2<T, P>& tmat2x2<T, P>::operator/= (tmat2x2<U, P> const & m)
|
||||
GLM_FUNC_QUALIFIER tmat2x2<T, P>& tmat2x2<T, P>::operator/=(tmat2x2<U, P> const & m)
|
||||
{
|
||||
return (*this = *this * detail::compute_inverse<detail::tmat2x2, T, P>::call(m));
|
||||
return (*this = *this * detail::compute_inverse<T, P>(m));
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
@ -370,34 +345,11 @@ namespace detail
|
||||
return Result;
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
struct compute_inverse<detail::tmat2x2, T, P>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static detail::tmat2x2<T, P> call(detail::tmat2x2<T, P> const & m)
|
||||
{
|
||||
T OneOverDeterminant = static_cast<T>(1) / (
|
||||
+ m[0][0] * m[1][1]
|
||||
- m[1][0] * m[0][1]);
|
||||
|
||||
detail::tmat2x2<T, P> Inverse(
|
||||
+ m[1][1] * OneOverDeterminant,
|
||||
- m[0][1] * OneOverDeterminant,
|
||||
- m[1][0] * OneOverDeterminant,
|
||||
+ m[0][0] * OneOverDeterminant);
|
||||
|
||||
return Inverse;
|
||||
}
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
// Binary operators
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat2x2<T, P> operator+
|
||||
(
|
||||
tmat2x2<T, P> const & m,
|
||||
T const & s
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat2x2<T, P> operator+(tmat2x2<T, P> const & m, T const & s)
|
||||
{
|
||||
return tmat2x2<T, P>(
|
||||
m[0] + s,
|
||||
@ -405,11 +357,7 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat2x2<T, P> operator+
|
||||
(
|
||||
T const & s,
|
||||
tmat2x2<T, P> const & m
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat2x2<T, P> operator+(T const & s, tmat2x2<T, P> const & m)
|
||||
{
|
||||
return tmat2x2<T, P>(
|
||||
m[0] + s,
|
||||
@ -417,11 +365,7 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat2x2<T, P> operator+
|
||||
(
|
||||
tmat2x2<T, P> const & m1,
|
||||
tmat2x2<T, P> const & m2
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat2x2<T, P> operator+(tmat2x2<T, P> const & m1, tmat2x2<T, P> const & m2)
|
||||
{
|
||||
return tmat2x2<T, P>(
|
||||
m1[0] + m2[0],
|
||||
@ -429,11 +373,7 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat2x2<T, P> operator-
|
||||
(
|
||||
tmat2x2<T, P> const & m,
|
||||
T const & s
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat2x2<T, P> operator-(tmat2x2<T, P> const & m, T const & s)
|
||||
{
|
||||
return tmat2x2<T, P>(
|
||||
m[0] - s,
|
||||
@ -441,11 +381,7 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat2x2<T, P> operator-
|
||||
(
|
||||
T const & s,
|
||||
tmat2x2<T, P> const & m
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat2x2<T, P> operator-(T const & s, tmat2x2<T, P> const & m)
|
||||
{
|
||||
return tmat2x2<T, P>(
|
||||
s - m[0],
|
||||
@ -453,11 +389,7 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat2x2<T, P> operator-
|
||||
(
|
||||
tmat2x2<T, P> const & m1,
|
||||
tmat2x2<T, P> const & m2
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat2x2<T, P> operator-(tmat2x2<T, P> const & m1, tmat2x2<T, P> const & m2)
|
||||
{
|
||||
return tmat2x2<T, P>(
|
||||
m1[0] - m2[0],
|
||||
@ -465,11 +397,7 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat2x2<T, P> operator*
|
||||
(
|
||||
tmat2x2<T, P> const & m,
|
||||
T const & s
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat2x2<T, P> operator*(tmat2x2<T, P> const & m, T const & s)
|
||||
{
|
||||
return tmat2x2<T, P>(
|
||||
m[0] * s,
|
||||
@ -477,11 +405,7 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat2x2<T, P> operator*
|
||||
(
|
||||
T const & s,
|
||||
tmat2x2<T, P> const & m
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat2x2<T, P> operator*(T const & s, tmat2x2<T, P> const & m)
|
||||
{
|
||||
return tmat2x2<T, P>(
|
||||
m[0] * s,
|
||||
@ -495,7 +419,7 @@ namespace detail
|
||||
typename tmat2x2<T, P>::row_type const & v
|
||||
)
|
||||
{
|
||||
return detail::tvec2<T, P>(
|
||||
return tvec2<T, P>(
|
||||
m[0][0] * v.x + m[1][0] * v.y,
|
||||
m[0][1] * v.x + m[1][1] * v.y);
|
||||
}
|
||||
@ -507,17 +431,13 @@ namespace detail
|
||||
tmat2x2<T, P> const & m
|
||||
)
|
||||
{
|
||||
return detail::tvec2<T, P>(
|
||||
return tvec2<T, P>(
|
||||
v.x * m[0][0] + v.y * m[0][1],
|
||||
v.x * m[1][0] + v.y * m[1][1]);
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat2x2<T, P> operator*
|
||||
(
|
||||
tmat2x2<T, P> const & m1,
|
||||
tmat2x2<T, P> const & m2
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat2x2<T, P> operator*(tmat2x2<T, P> const & m1, tmat2x2<T, P> const & m2)
|
||||
{
|
||||
return tmat2x2<T, P>(
|
||||
m1[0][0] * m2[0][0] + m1[1][0] * m2[0][1],
|
||||
@ -527,11 +447,7 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat3x2<T, P> operator*
|
||||
(
|
||||
tmat2x2<T, P> const & m1,
|
||||
tmat3x2<T, P> const & m2
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat3x2<T, P> operator*(tmat2x2<T, P> const & m1, tmat3x2<T, P> const & m2)
|
||||
{
|
||||
return tmat3x2<T, P>(
|
||||
m1[0][0] * m2[0][0] + m1[1][0] * m2[0][1],
|
||||
@ -543,11 +459,7 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat4x2<T, P> operator*
|
||||
(
|
||||
tmat2x2<T, P> const & m1,
|
||||
tmat4x2<T, P> const & m2
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat4x2<T, P> operator*(tmat2x2<T, P> const & m1, tmat4x2<T, P> const & m2)
|
||||
{
|
||||
return tmat4x2<T, P>(
|
||||
m1[0][0] * m2[0][0] + m1[1][0] * m2[0][1],
|
||||
@ -561,11 +473,7 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat2x2<T, P> operator/
|
||||
(
|
||||
tmat2x2<T, P> const & m,
|
||||
T const & s
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat2x2<T, P> operator/(tmat2x2<T, P> const & m, T const & s)
|
||||
{
|
||||
return tmat2x2<T, P>(
|
||||
m[0] / s,
|
||||
@ -573,11 +481,7 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat2x2<T, P> operator/
|
||||
(
|
||||
T const & s,
|
||||
tmat2x2<T, P> const & m
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat2x2<T, P> operator/(T const & s, tmat2x2<T, P> const & m)
|
||||
{
|
||||
return tmat2x2<T, P>(
|
||||
s / m[0],
|
||||
@ -585,31 +489,19 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER typename tmat2x2<T, P>::col_type operator/
|
||||
(
|
||||
tmat2x2<T, P> const & m,
|
||||
typename tmat2x2<T, P>::row_type & v
|
||||
)
|
||||
GLM_FUNC_QUALIFIER typename tmat2x2<T, P>::col_type operator/(tmat2x2<T, P> const & m, typename tmat2x2<T, P>::row_type const & v)
|
||||
{
|
||||
return detail::compute_inverse<detail::tmat2x2, T, P>::call(m) * v;
|
||||
return detail::compute_inverse<T, P>(m) * v;
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER typename tmat2x2<T, P>::row_type operator/
|
||||
(
|
||||
typename tmat2x2<T, P>::col_type const & v,
|
||||
tmat2x2<T, P> const & m
|
||||
)
|
||||
GLM_FUNC_QUALIFIER typename tmat2x2<T, P>::row_type operator/(typename tmat2x2<T, P>::col_type const & v, tmat2x2<T, P> const & m)
|
||||
{
|
||||
return v * detail::compute_inverse<detail::tmat2x2, T, P>::call(m);
|
||||
return v * detail::compute_inverse<T, P>(m);
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat2x2<T, P> operator/
|
||||
(
|
||||
tmat2x2<T, P> const & m1,
|
||||
tmat2x2<T, P> const & m2
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat2x2<T, P> operator/(tmat2x2<T, P> const & m1, tmat2x2<T, P> const & m2)
|
||||
{
|
||||
tmat2x2<T, P> m1_copy(m1);
|
||||
return m1_copy /= m2;
|
||||
@ -617,10 +509,7 @@ namespace detail
|
||||
|
||||
// Unary constant operators
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat2x2<T, P> const operator-
|
||||
(
|
||||
tmat2x2<T, P> const & m
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat2x2<T, P> const operator-(tmat2x2<T, P> const & m)
|
||||
{
|
||||
return tmat2x2<T, P>(
|
||||
-m[0],
|
||||
@ -631,24 +520,14 @@ namespace detail
|
||||
// Boolean operators
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER bool operator==
|
||||
(
|
||||
tmat2x2<T, P> const & m1,
|
||||
tmat2x2<T, P> const & m2
|
||||
)
|
||||
GLM_FUNC_QUALIFIER bool operator==(tmat2x2<T, P> const & m1, tmat2x2<T, P> const & m2)
|
||||
{
|
||||
return (m1[0] == m2[0]) && (m1[1] == m2[1]);
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER bool operator!=
|
||||
(
|
||||
tmat2x2<T, P> const & m1,
|
||||
tmat2x2<T, P> const & m2
|
||||
)
|
||||
GLM_FUNC_QUALIFIER bool operator!=(tmat2x2<T, P> const & m1, tmat2x2<T, P> const & m2)
|
||||
{
|
||||
return (m1[0] != m2[0]) || (m1[1] != m2[1]);
|
||||
}
|
||||
|
||||
} //namespace detail
|
||||
} //namespace glm
|
||||
|
||||
@ -12,6 +12,10 @@
|
||||
/// 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
|
||||
@ -21,51 +25,44 @@
|
||||
/// THE SOFTWARE.
|
||||
///
|
||||
/// @ref core
|
||||
/// @file glm/core/type_mat2x3.hpp
|
||||
/// @file glm/detail/type_mat2x3.hpp
|
||||
/// @date 2006-10-01 / 2011-06-15
|
||||
/// @author Christophe Riccio
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef glm_core_type_mat2x3
|
||||
#define glm_core_type_mat2x3
|
||||
#pragma once
|
||||
|
||||
#include "../fwd.hpp"
|
||||
#include "type_vec2.hpp"
|
||||
#include "type_vec3.hpp"
|
||||
#include "type_mat.hpp"
|
||||
#include <limits>
|
||||
#include <cstddef>
|
||||
|
||||
namespace glm{
|
||||
namespace detail
|
||||
namespace glm
|
||||
{
|
||||
template <typename T, precision P>
|
||||
template <typename T, precision P = defaultp>
|
||||
struct tmat2x3
|
||||
{
|
||||
enum ctor{_null};
|
||||
typedef T value_type;
|
||||
typedef std::size_t size_type;
|
||||
typedef tvec3<T, P> col_type;
|
||||
typedef tvec2<T, P> row_type;
|
||||
typedef tmat2x3<T, P> type;
|
||||
typedef tmat3x2<T, P> transpose_type;
|
||||
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const;
|
||||
typedef T value_type;
|
||||
|
||||
private:
|
||||
// Data
|
||||
/// @cond DETAIL
|
||||
col_type value[2];
|
||||
|
||||
/// @endcond
|
||||
|
||||
public:
|
||||
// Constructors
|
||||
GLM_FUNC_DECL tmat2x3();
|
||||
GLM_FUNC_DECL tmat2x3(tmat2x3<T, P> const & m);
|
||||
template <precision Q>
|
||||
GLM_FUNC_DECL tmat2x3(tmat2x3<T, Q> const & m);
|
||||
|
||||
GLM_FUNC_DECL explicit tmat2x3(
|
||||
ctor);
|
||||
GLM_FUNC_DECL explicit tmat2x3(
|
||||
T const & s);
|
||||
GLM_FUNC_DECL explicit tmat2x3(ctor);
|
||||
GLM_FUNC_DECL explicit tmat2x3(T const & s);
|
||||
GLM_FUNC_DECL tmat2x3(
|
||||
T const & x0, T const & y0, T const & z0,
|
||||
T const & x1, T const & y1, T const & z1);
|
||||
@ -75,6 +72,7 @@ namespace detail
|
||||
|
||||
//////////////////////////////////////
|
||||
// Conversions
|
||||
|
||||
template <typename X1, typename Y1, typename Z1, typename X2, typename Y2, typename Z2>
|
||||
GLM_FUNC_DECL tmat2x3(
|
||||
X1 const & x1, Y1 const & y1, Z1 const & z1,
|
||||
@ -87,8 +85,14 @@ namespace detail
|
||||
|
||||
//////////////////////////////////////
|
||||
// Matrix conversion
|
||||
template <typename U, precision Q>
|
||||
GLM_FUNC_DECL explicit tmat2x3(tmat2x3<U, Q> const & m);
|
||||
|
||||
# ifdef GLM_FORCE_EXPLICIT_CTOR
|
||||
template <typename U, precision Q>
|
||||
GLM_FUNC_DECL explicit tmat2x3(tmat2x3<U, Q> const & m);
|
||||
# else
|
||||
template <typename U, precision Q>
|
||||
GLM_FUNC_DECL tmat2x3(tmat2x3<U, Q> const & m);
|
||||
# endif
|
||||
|
||||
GLM_FUNC_DECL explicit tmat2x3(tmat2x2<T, P> const & x);
|
||||
GLM_FUNC_DECL explicit tmat2x3(tmat3x3<T, P> const & x);
|
||||
@ -99,12 +103,26 @@ namespace detail
|
||||
GLM_FUNC_DECL explicit tmat2x3(tmat4x2<T, P> const & x);
|
||||
GLM_FUNC_DECL explicit tmat2x3(tmat4x3<T, P> const & x);
|
||||
|
||||
//////////////////////////////////////
|
||||
// Accesses
|
||||
GLM_FUNC_DECL col_type & operator[](length_t i);
|
||||
GLM_FUNC_DECL col_type const & operator[](length_t i) const;
|
||||
|
||||
// Unary updatable operators
|
||||
GLM_FUNC_DECL tmat2x3<T, P> & operator= (tmat2x3<T, P> const & m);
|
||||
# ifdef GLM_FORCE_SIZE_FUNC
|
||||
typedef size_t size_type;
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR size_t size() const;
|
||||
|
||||
GLM_FUNC_DECL col_type & operator[](size_type i);
|
||||
GLM_FUNC_DECL col_type const & operator[](size_type i) const;
|
||||
# else
|
||||
typedef length_t length_type;
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR length_type length() const;
|
||||
|
||||
GLM_FUNC_DECL col_type & operator[](length_type i);
|
||||
GLM_FUNC_DECL col_type const & operator[](length_type i) const;
|
||||
# endif//GLM_FORCE_SIZE_FUNC
|
||||
|
||||
//////////////////////////////////////
|
||||
// Unary arithmetic operators
|
||||
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tmat2x3<T, P> & operator= (tmat2x3<U, P> const & m);
|
||||
template <typename U>
|
||||
@ -200,12 +218,8 @@ namespace detail
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tmat2x3<T, P> const operator- (
|
||||
tmat2x3<T, P> const & m);
|
||||
|
||||
}//namespace detail
|
||||
}//namespace glm
|
||||
|
||||
#ifndef GLM_EXTERNAL_TEMPLATE
|
||||
#include "type_mat2x3.inl"
|
||||
#endif
|
||||
|
||||
#endif //glm_core_type_mat2x3
|
||||
|
||||
@ -12,6 +12,10 @@
|
||||
/// 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
|
||||
@ -21,89 +25,42 @@
|
||||
/// THE SOFTWARE.
|
||||
///
|
||||
/// @ref core
|
||||
/// @file glm/core/type_mat2x3.inl
|
||||
/// @file glm/detail/type_mat2x3.inl
|
||||
/// @date 2006-08-05 / 2011-06-15
|
||||
/// @author Christophe Riccio
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
namespace glm{
|
||||
namespace detail
|
||||
namespace glm
|
||||
{
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR length_t tmat2x3<T, P>::length() const
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
//////////////////////////////////////
|
||||
// Accesses
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER typename tmat2x3<T, P>::col_type &
|
||||
tmat2x3<T, P>::operator[]
|
||||
(
|
||||
length_t i
|
||||
)
|
||||
{
|
||||
assert(i < this->length());
|
||||
return this->value[i];
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER typename tmat2x3<T, P>::col_type const &
|
||||
tmat2x3<T, P>::operator[]
|
||||
(
|
||||
length_t i
|
||||
) const
|
||||
{
|
||||
assert(i < this->length());
|
||||
return this->value[i];
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
// Constructors
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat2x3<T, P>::tmat2x3()
|
||||
{
|
||||
this->value[0] = col_type(T(1), T(0), T(0));
|
||||
this->value[1] = col_type(T(0), T(1), T(0));
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat2x3<T, P>::tmat2x3
|
||||
(
|
||||
tmat2x3<T, P> const & m
|
||||
)
|
||||
{
|
||||
this->value[0] = m.value[0];
|
||||
this->value[1] = m.value[1];
|
||||
# ifndef GLM_FORCE_NO_CTOR_INIT
|
||||
this->value[0] = col_type(1, 0, 0);
|
||||
this->value[1] = col_type(0, 1, 0);
|
||||
# endif
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
template <precision Q>
|
||||
GLM_FUNC_QUALIFIER tmat2x3<T, P>::tmat2x3(
|
||||
tmat2x3<T, Q> const & m)
|
||||
GLM_FUNC_QUALIFIER tmat2x3<T, P>::tmat2x3(tmat2x3<T, Q> const & m)
|
||||
{
|
||||
this->value[0] = m.value[0];
|
||||
this->value[1] = m.value[1];
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat2x3<T, P>::tmat2x3
|
||||
(
|
||||
ctor
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat2x3<T, P>::tmat2x3(ctor)
|
||||
{}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat2x3<T, P>::tmat2x3
|
||||
(
|
||||
T const & s
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat2x3<T, P>::tmat2x3(T const & s)
|
||||
{
|
||||
this->value[0] = col_type(s, T(0), T(0));
|
||||
this->value[1] = col_type(T(0), s, T(0));
|
||||
this->value[0] = col_type(s, 0, 0);
|
||||
this->value[1] = col_type(0, s, 0);
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
@ -118,11 +75,7 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat2x3<T, P>::tmat2x3
|
||||
(
|
||||
col_type const & v0,
|
||||
col_type const & v1
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat2x3<T, P>::tmat2x3(col_type const & v0, col_type const & v1)
|
||||
{
|
||||
this->value[0] = v0;
|
||||
this->value[1] = v1;
|
||||
@ -146,11 +99,7 @@ namespace detail
|
||||
|
||||
template <typename T, precision P>
|
||||
template <typename V1, typename V2>
|
||||
GLM_FUNC_QUALIFIER tmat2x3<T, P>::tmat2x3
|
||||
(
|
||||
tvec3<V1, P> const & v1,
|
||||
tvec3<V2, P> const & v2
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat2x3<T, P>::tmat2x3(tvec3<V1, P> const & v1, tvec3<V2, P> const & v2)
|
||||
{
|
||||
this->value[0] = col_type(v1);
|
||||
this->value[1] = col_type(v2);
|
||||
@ -161,154 +110,164 @@ namespace detail
|
||||
|
||||
template <typename T, precision P>
|
||||
template <typename U, precision Q>
|
||||
GLM_FUNC_QUALIFIER tmat2x3<T, P>::tmat2x3
|
||||
(
|
||||
tmat2x3<U, Q> const & m
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat2x3<T, P>::tmat2x3(tmat2x3<U, Q> const & m)
|
||||
{
|
||||
this->value[0] = col_type(m[0]);
|
||||
this->value[1] = col_type(m[1]);
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat2x3<T, P>::tmat2x3
|
||||
(
|
||||
tmat2x2<T, P> const & m
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat2x3<T, P>::tmat2x3(tmat2x2<T, P> const & m)
|
||||
{
|
||||
this->value[0] = col_type(m[0], T(0));
|
||||
this->value[1] = col_type(m[1], T(0));
|
||||
this->value[0] = col_type(m[0], 0);
|
||||
this->value[1] = col_type(m[1], 0);
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat2x3<T, P>::tmat2x3
|
||||
(
|
||||
tmat3x3<T, P> const & m
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat2x3<T, P>::tmat2x3(tmat3x3<T, P> const & m)
|
||||
{
|
||||
this->value[0] = col_type(m[0]);
|
||||
this->value[1] = col_type(m[1]);
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat2x3<T, P>::tmat2x3
|
||||
(
|
||||
tmat4x4<T, P> const & m
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat2x3<T, P>::tmat2x3(tmat4x4<T, P> const & m)
|
||||
{
|
||||
this->value[0] = col_type(m[0]);
|
||||
this->value[1] = col_type(m[1]);
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat2x3<T, P>::tmat2x3
|
||||
(
|
||||
tmat2x4<T, P> const & m
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat2x3<T, P>::tmat2x3(tmat2x4<T, P> const & m)
|
||||
{
|
||||
this->value[0] = col_type(m[0]);
|
||||
this->value[1] = col_type(m[1]);
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat2x3<T, P>::tmat2x3
|
||||
(
|
||||
tmat3x2<T, P> const & m
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat2x3<T, P>::tmat2x3(tmat3x2<T, P> const & m)
|
||||
{
|
||||
this->value[0] = col_type(m[0], T(0));
|
||||
this->value[1] = col_type(m[1], T(0));
|
||||
this->value[0] = col_type(m[0], 0);
|
||||
this->value[1] = col_type(m[1], 0);
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat2x3<T, P>::tmat2x3
|
||||
(
|
||||
tmat3x4<T, P> const & m
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat2x3<T, P>::tmat2x3(tmat3x4<T, P> const & m)
|
||||
{
|
||||
this->value[0] = col_type(m[0]);
|
||||
this->value[1] = col_type(m[1]);
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat2x3<T, P>::tmat2x3
|
||||
(
|
||||
tmat4x2<T, P> const & m
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat2x3<T, P>::tmat2x3(tmat4x2<T, P> const & m)
|
||||
{
|
||||
this->value[0] = col_type(m[0], T(0));
|
||||
this->value[1] = col_type(m[1], T(0));
|
||||
this->value[0] = col_type(m[0], 0);
|
||||
this->value[1] = col_type(m[1], 0);
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat2x3<T, P>::tmat2x3
|
||||
(
|
||||
tmat4x3<T, P> const & m
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat2x3<T, P>::tmat2x3(tmat4x3<T, P> const & m)
|
||||
{
|
||||
this->value[0] = m[0];
|
||||
this->value[1] = m[1];
|
||||
}
|
||||
|
||||
//////////////////////////////////////
|
||||
// Accesses
|
||||
|
||||
# ifdef GLM_FORCE_SIZE_FUNC
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tmat2x3<T, P>::size_type tmat2x3<T, P>::size() const
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER typename tmat2x3<T, P>::col_type & tmat2x3<T, P>::operator[](typename tmat2x3<T, P>::size_type i)
|
||||
{
|
||||
assert(i < this->size());
|
||||
return this->value[i];
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER typename tmat2x3<T, P>::col_type const & tmat2x3<T, P>::operator[](typename tmat2x3<T, P>::size_type i) const
|
||||
{
|
||||
assert(i < this->size());
|
||||
return this->value[i];
|
||||
}
|
||||
# else
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tmat2x3<T, P>::length_type tmat2x3<T, P>::length() const
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER typename tmat2x3<T, P>::col_type & tmat2x3<T, P>::operator[](typename tmat2x3<T, P>::length_type i)
|
||||
{
|
||||
assert(i < this->length());
|
||||
return this->value[i];
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER typename tmat2x3<T, P>::col_type const & tmat2x3<T, P>::operator[](typename tmat2x3<T, P>::length_type i) const
|
||||
{
|
||||
assert(i < this->length());
|
||||
return this->value[i];
|
||||
}
|
||||
# endif//GLM_FORCE_SIZE_FUNC
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
// Unary updatable operators
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat2x3<T, P>& tmat2x3<T, P>::operator= (tmat2x3<T, P> const & m)
|
||||
template <typename U>
|
||||
GLM_FUNC_QUALIFIER tmat2x3<T, P>& tmat2x3<T, P>::operator=(tmat2x3<U, P> const & m)
|
||||
{
|
||||
this->value[0] = m[0];
|
||||
this->value[1] = m[1];
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
template <typename U>
|
||||
GLM_FUNC_QUALIFIER tmat2x3<T, P>& tmat2x3<T, P>::operator= (tmat2x3<U, P> const & m)
|
||||
{
|
||||
this->value[0] = m[0];
|
||||
this->value[1] = m[1];
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
template <typename U>
|
||||
GLM_FUNC_QUALIFIER tmat2x3<T, P> & tmat2x3<T, P>::operator+= (U s)
|
||||
template <typename T, precision P>
|
||||
template <typename U>
|
||||
GLM_FUNC_QUALIFIER tmat2x3<T, P> & tmat2x3<T, P>::operator+=(U s)
|
||||
{
|
||||
this->value[0] += s;
|
||||
this->value[1] += s;
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
template <typename U>
|
||||
GLM_FUNC_QUALIFIER tmat2x3<T, P>& tmat2x3<T, P>::operator+= (tmat2x3<U, P> const & m)
|
||||
template <typename T, precision P>
|
||||
template <typename U>
|
||||
GLM_FUNC_QUALIFIER tmat2x3<T, P>& tmat2x3<T, P>::operator+=(tmat2x3<U, P> const & m)
|
||||
{
|
||||
this->value[0] += m[0];
|
||||
this->value[1] += m[1];
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
template <typename U>
|
||||
GLM_FUNC_QUALIFIER tmat2x3<T, P>& tmat2x3<T, P>::operator-= (U s)
|
||||
template <typename T, precision P>
|
||||
template <typename U>
|
||||
GLM_FUNC_QUALIFIER tmat2x3<T, P>& tmat2x3<T, P>::operator-=(U s)
|
||||
{
|
||||
this->value[0] -= s;
|
||||
this->value[1] -= s;
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
template <typename U>
|
||||
GLM_FUNC_QUALIFIER tmat2x3<T, P>& tmat2x3<T, P>::operator-= (tmat2x3<U, P> const & m)
|
||||
template <typename T, precision P>
|
||||
template <typename U>
|
||||
GLM_FUNC_QUALIFIER tmat2x3<T, P>& tmat2x3<T, P>::operator-=(tmat2x3<U, P> const & m)
|
||||
{
|
||||
this->value[0] -= m[0];
|
||||
this->value[1] -= m[1];
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
template <typename U>
|
||||
GLM_FUNC_QUALIFIER tmat2x3<T, P>& tmat2x3<T, P>::operator*= (U s)
|
||||
template <typename T, precision P>
|
||||
template <typename U>
|
||||
GLM_FUNC_QUALIFIER tmat2x3<T, P>& tmat2x3<T, P>::operator*=(U s)
|
||||
{
|
||||
this->value[0] *= s;
|
||||
this->value[1] *= s;
|
||||
@ -316,15 +275,15 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
template <typename U>
|
||||
GLM_FUNC_QUALIFIER tmat2x3<T, P> & tmat2x3<T, P>::operator/= (U s)
|
||||
template <typename U>
|
||||
GLM_FUNC_QUALIFIER tmat2x3<T, P> & tmat2x3<T, P>::operator/=(U s)
|
||||
{
|
||||
this->value[0] /= s;
|
||||
this->value[1] /= s;
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat2x3<T, P> & tmat2x3<T, P>::operator++()
|
||||
{
|
||||
++this->value[0];
|
||||
@ -332,7 +291,7 @@ namespace detail
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat2x3<T, P> & tmat2x3<T, P>::operator--()
|
||||
{
|
||||
--this->value[0];
|
||||
@ -360,11 +319,7 @@ namespace detail
|
||||
// Binary operators
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat2x3<T, P> operator+
|
||||
(
|
||||
tmat2x3<T, P> const & m,
|
||||
T const & s
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat2x3<T, P> operator+(tmat2x3<T, P> const & m, T const & s)
|
||||
{
|
||||
return tmat2x3<T, P>(
|
||||
m[0] + s,
|
||||
@ -372,11 +327,7 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat2x3<T, P> operator+
|
||||
(
|
||||
tmat2x3<T, P> const & m1,
|
||||
tmat2x3<T, P> const & m2
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat2x3<T, P> operator+(tmat2x3<T, P> const & m1, tmat2x3<T, P> const & m2)
|
||||
{
|
||||
return tmat2x3<T, P>(
|
||||
m1[0] + m2[0],
|
||||
@ -384,11 +335,7 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat2x3<T, P> operator-
|
||||
(
|
||||
tmat2x3<T, P> const & m,
|
||||
T const & s
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat2x3<T, P> operator-(tmat2x3<T, P> const & m, T const & s)
|
||||
{
|
||||
return tmat2x3<T, P>(
|
||||
m[0] - s,
|
||||
@ -396,11 +343,7 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat2x3<T, P> operator-
|
||||
(
|
||||
tmat2x3<T, P> const & m1,
|
||||
tmat2x3<T, P> const & m2
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat2x3<T, P> operator-(tmat2x3<T, P> const & m1, tmat2x3<T, P> const & m2)
|
||||
{
|
||||
return tmat2x3<T, P>(
|
||||
m1[0] - m2[0],
|
||||
@ -408,11 +351,7 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat2x3<T, P> operator*
|
||||
(
|
||||
tmat2x3<T, P> const & m,
|
||||
T const & s
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat2x3<T, P> operator*(tmat2x3<T, P> const & m, T const & s)
|
||||
{
|
||||
return tmat2x3<T, P>(
|
||||
m[0] * s,
|
||||
@ -420,11 +359,7 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat2x3<T, P> operator*
|
||||
(
|
||||
T const & s,
|
||||
tmat2x3<T, P> const & m
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat2x3<T, P> operator*(T const & s, tmat2x3<T, P> const & m)
|
||||
{
|
||||
return tmat2x3<T, P>(
|
||||
m[0] * s,
|
||||
@ -455,11 +390,7 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat2x3<T, P> operator*
|
||||
(
|
||||
tmat2x3<T, P> const & m1,
|
||||
tmat2x2<T, P> const & m2
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat2x3<T, P> operator*(tmat2x3<T, P> const & m1, tmat2x2<T, P> const & m2)
|
||||
{
|
||||
return tmat2x3<T, P>(
|
||||
m1[0][0] * m2[0][0] + m1[1][0] * m2[0][1],
|
||||
@ -471,11 +402,7 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat3x3<T, P> operator*
|
||||
(
|
||||
tmat2x3<T, P> const & m1,
|
||||
tmat3x2<T, P> const & m2
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat3x3<T, P> operator*(tmat2x3<T, P> const & m1, tmat3x2<T, P> const & m2)
|
||||
{
|
||||
T SrcA00 = m1[0][0];
|
||||
T SrcA01 = m1[0][1];
|
||||
@ -491,7 +418,7 @@ namespace detail
|
||||
T SrcB20 = m2[2][0];
|
||||
T SrcB21 = m2[2][1];
|
||||
|
||||
tmat3x3<T, P> Result(tmat3x3<T, P>::_null);
|
||||
tmat3x3<T, P> Result(uninitialize);
|
||||
Result[0][0] = SrcA00 * SrcB00 + SrcA10 * SrcB01;
|
||||
Result[0][1] = SrcA01 * SrcB00 + SrcA11 * SrcB01;
|
||||
Result[0][2] = SrcA02 * SrcB00 + SrcA12 * SrcB01;
|
||||
@ -505,11 +432,7 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat4x3<T, P> operator*
|
||||
(
|
||||
tmat2x3<T, P> const & m1,
|
||||
tmat4x2<T, P> const & m2
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat4x3<T, P> operator*(tmat2x3<T, P> const & m1, tmat3x2<T, P> const & m2)
|
||||
{
|
||||
return tmat4x3<T, P>(
|
||||
m1[0][0] * m2[0][0] + m1[1][0] * m2[0][1],
|
||||
@ -527,11 +450,7 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat2x3<T, P> operator/
|
||||
(
|
||||
tmat2x3<T, P> const & m,
|
||||
T const & s
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat2x3<T, P> operator/(tmat2x3<T, P> const & m, T const & s)
|
||||
{
|
||||
return tmat2x3<T, P>(
|
||||
m[0] / s,
|
||||
@ -539,11 +458,7 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat2x3<T, P> operator/
|
||||
(
|
||||
T const & s,
|
||||
tmat2x3<T, P> const & m
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat2x3<T, P> operator/(T const & s, tmat2x3<T, P> const & m)
|
||||
{
|
||||
return tmat2x3<T, P>(
|
||||
s / m[0],
|
||||
@ -552,10 +467,7 @@ namespace detail
|
||||
|
||||
// Unary constant operators
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat2x3<T, P> const operator-
|
||||
(
|
||||
tmat2x3<T, P> const & m
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat2x3<T, P> const operator-(tmat2x3<T, P> const & m)
|
||||
{
|
||||
return tmat2x3<T, P>(
|
||||
-m[0],
|
||||
@ -566,23 +478,14 @@ namespace detail
|
||||
// Boolean operators
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER bool operator==
|
||||
(
|
||||
tmat2x3<T, P> const & m1,
|
||||
tmat2x3<T, P> const & m2
|
||||
)
|
||||
GLM_FUNC_QUALIFIER bool operator==(tmat2x3<T, P> const & m1, tmat2x3<T, P> const & m2)
|
||||
{
|
||||
return (m1[0] == m2[0]) && (m1[1] == m2[1]);
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER bool operator!=
|
||||
(
|
||||
tmat2x3<T, P> const & m1,
|
||||
tmat2x3<T, P> const & m2
|
||||
)
|
||||
GLM_FUNC_QUALIFIER bool operator!=(tmat2x3<T, P> const & m1, tmat2x3<T, P> const & m2)
|
||||
{
|
||||
return (m1[0] != m2[0]) || (m1[1] != m2[1]);
|
||||
}
|
||||
} //namespace detail
|
||||
} //namespace glm
|
||||
|
||||
@ -12,6 +12,10 @@
|
||||
/// 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
|
||||
@ -21,51 +25,44 @@
|
||||
/// THE SOFTWARE.
|
||||
///
|
||||
/// @ref core
|
||||
/// @file glm/core/type_mat2x4.hpp
|
||||
/// @file glm/detail/type_mat2x4.hpp
|
||||
/// @date 2006-08-05 / 2011-06-15
|
||||
/// @author Christophe Riccio
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef glm_core_type_mat2x4
|
||||
#define glm_core_type_mat2x4
|
||||
#pragma once
|
||||
|
||||
#include "../fwd.hpp"
|
||||
#include "type_vec2.hpp"
|
||||
#include "type_vec4.hpp"
|
||||
#include "type_mat.hpp"
|
||||
#include <limits>
|
||||
#include <cstddef>
|
||||
|
||||
namespace glm{
|
||||
namespace detail
|
||||
namespace glm
|
||||
{
|
||||
template <typename T, precision P>
|
||||
template <typename T, precision P = defaultp>
|
||||
struct tmat2x4
|
||||
{
|
||||
enum ctor{_null};
|
||||
typedef T value_type;
|
||||
typedef std::size_t size_type;
|
||||
typedef tvec4<T, P> col_type;
|
||||
typedef tvec2<T, P> row_type;
|
||||
typedef tmat2x4<T, P> type;
|
||||
typedef tmat4x2<T, P> transpose_type;
|
||||
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const;
|
||||
typedef T value_type;
|
||||
|
||||
private:
|
||||
// Data
|
||||
/// @cond DETAIL
|
||||
col_type value[2];
|
||||
|
||||
/// @endcond
|
||||
|
||||
public:
|
||||
// Constructors
|
||||
GLM_FUNC_DECL tmat2x4();
|
||||
GLM_FUNC_DECL tmat2x4(tmat2x4<T, P> const & m);
|
||||
template <precision Q>
|
||||
GLM_FUNC_DECL tmat2x4(tmat2x4<T, Q> const & m);
|
||||
|
||||
GLM_FUNC_DECL explicit tmat2x4(
|
||||
ctor);
|
||||
GLM_FUNC_DECL explicit tmat2x4(
|
||||
T const & s);
|
||||
GLM_FUNC_DECL explicit tmat2x4(ctor);
|
||||
GLM_FUNC_DECL explicit tmat2x4(T const & s);
|
||||
GLM_FUNC_DECL tmat2x4(
|
||||
T const & x0, T const & y0, T const & z0, T const & w0,
|
||||
T const & x1, T const & y1, T const & z1, T const & w1);
|
||||
@ -89,8 +86,14 @@ namespace detail
|
||||
|
||||
//////////////////////////////////////
|
||||
// Matrix conversions
|
||||
template <typename U, precision Q>
|
||||
GLM_FUNC_DECL explicit tmat2x4(tmat2x4<U, Q> const & m);
|
||||
|
||||
# ifdef GLM_FORCE_EXPLICIT_CTOR
|
||||
template <typename U, precision Q>
|
||||
GLM_FUNC_DECL explicit tmat2x4(tmat2x4<U, Q> const & m);
|
||||
# else
|
||||
template <typename U, precision Q>
|
||||
GLM_FUNC_DECL tmat2x4(tmat2x4<U, Q> const & m);
|
||||
# endif
|
||||
|
||||
GLM_FUNC_DECL explicit tmat2x4(tmat2x2<T, P> const & x);
|
||||
GLM_FUNC_DECL explicit tmat2x4(tmat3x3<T, P> const & x);
|
||||
@ -101,12 +104,26 @@ namespace detail
|
||||
GLM_FUNC_DECL explicit tmat2x4(tmat4x2<T, P> const & x);
|
||||
GLM_FUNC_DECL explicit tmat2x4(tmat4x3<T, P> const & x);
|
||||
|
||||
//////////////////////////////////////
|
||||
// Accesses
|
||||
GLM_FUNC_DECL col_type & operator[](length_t i);
|
||||
GLM_FUNC_DECL col_type const & operator[](length_t i) const;
|
||||
|
||||
// Unary updatable operators
|
||||
GLM_FUNC_DECL tmat2x4<T, P>& operator= (tmat2x4<T, P> const & m);
|
||||
# ifdef GLM_FORCE_SIZE_FUNC
|
||||
typedef size_t size_type;
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR size_t size() const;
|
||||
|
||||
GLM_FUNC_DECL col_type & operator[](size_type i);
|
||||
GLM_FUNC_DECL col_type const & operator[](size_type i) const;
|
||||
# else
|
||||
typedef length_t length_type;
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR length_type length() const;
|
||||
|
||||
GLM_FUNC_DECL col_type & operator[](length_type i);
|
||||
GLM_FUNC_DECL col_type const & operator[](length_type i) const;
|
||||
# endif//GLM_FORCE_SIZE_FUNC
|
||||
|
||||
//////////////////////////////////////
|
||||
// Unary arithmetic operators
|
||||
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tmat2x4<T, P>& operator= (tmat2x4<U, P> const & m);
|
||||
template <typename U>
|
||||
@ -191,23 +208,19 @@ namespace detail
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tmat2x4<T, P> operator/ (
|
||||
tmat2x4<T, P> const & m,
|
||||
T const & s);
|
||||
T s);
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tmat2x4<T, P> operator/ (
|
||||
T const & s,
|
||||
T s,
|
||||
tmat2x4<T, P> const & m);
|
||||
|
||||
// Unary constant operators
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tmat2x4<T, P> const operator- (
|
||||
tmat2x4<T, P> const & m);
|
||||
|
||||
}//namespace detail
|
||||
}//namespace glm
|
||||
|
||||
#ifndef GLM_EXTERNAL_TEMPLATE
|
||||
#include "type_mat2x4.inl"
|
||||
#endif
|
||||
|
||||
#endif //glm_core_type_mat2x4
|
||||
|
||||
@ -12,6 +12,10 @@
|
||||
/// 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
|
||||
@ -21,88 +25,39 @@
|
||||
/// THE SOFTWARE.
|
||||
///
|
||||
/// @ref core
|
||||
/// @file glm/core/type_mat2x4.inl
|
||||
/// @file glm/detail/type_mat2x4.inl
|
||||
/// @date 2006-08-05 / 2011-06-15
|
||||
/// @author Christophe Riccio
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
namespace glm{
|
||||
namespace detail
|
||||
namespace glm
|
||||
{
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR length_t tmat2x4<T, P>::length() const
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
//////////////////////////////////////
|
||||
// Accesses
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER typename tmat2x4<T, P>::col_type &
|
||||
tmat2x4<T, P>::operator[]
|
||||
(
|
||||
length_t i
|
||||
)
|
||||
{
|
||||
assert(i < this->length());
|
||||
return this->value[i];
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER typename tmat2x4<T, P>::col_type const &
|
||||
tmat2x4<T, P>::operator[]
|
||||
(
|
||||
length_t i
|
||||
) const
|
||||
{
|
||||
assert(i < this->length());
|
||||
return this->value[i];
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
// Constructors
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat2x4<T, P>::tmat2x4()
|
||||
{
|
||||
value_type const Zero(0);
|
||||
value_type const One(1);
|
||||
this->value[0] = col_type(One, Zero, Zero, Zero);
|
||||
this->value[1] = col_type(Zero, One, Zero, Zero);
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat2x4<T, P>::tmat2x4
|
||||
(
|
||||
tmat2x4<T, P> const & m
|
||||
)
|
||||
{
|
||||
this->value[0] = m.value[0];
|
||||
this->value[1] = m.value[1];
|
||||
# ifndef GLM_FORCE_NO_CTOR_INIT
|
||||
this->value[0] = col_type(1, 0, 0, 0);
|
||||
this->value[1] = col_type(0, 1, 0, 0);
|
||||
# endif
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
template <precision Q>
|
||||
GLM_FUNC_QUALIFIER tmat2x4<T, P>::tmat2x4(
|
||||
tmat2x4<T, Q> const & m)
|
||||
GLM_FUNC_QUALIFIER tmat2x4<T, P>::tmat2x4(tmat2x4<T, Q> const & m)
|
||||
{
|
||||
this->value[0] = m.value[0];
|
||||
this->value[1] = m.value[1];
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat2x4<T, P>::tmat2x4
|
||||
(
|
||||
ctor
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat2x4<T, P>::tmat2x4(ctor)
|
||||
{}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat2x4<T, P>::tmat2x4
|
||||
(
|
||||
T const & s
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat2x4<T, P>::tmat2x4(T const & s)
|
||||
{
|
||||
value_type const Zero(0);
|
||||
this->value[0] = col_type(s, Zero, Zero, Zero);
|
||||
@ -121,11 +76,7 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat2x4<T, P>::tmat2x4
|
||||
(
|
||||
col_type const & v0,
|
||||
col_type const & v1
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat2x4<T, P>::tmat2x4(col_type const & v0, col_type const & v1)
|
||||
{
|
||||
this->value[0] = v0;
|
||||
this->value[1] = v1;
|
||||
@ -149,11 +100,7 @@ namespace detail
|
||||
|
||||
template <typename T, precision P>
|
||||
template <typename V1, typename V2>
|
||||
GLM_FUNC_QUALIFIER tmat2x4<T, P>::tmat2x4
|
||||
(
|
||||
tvec4<V1, P> const & v1,
|
||||
tvec4<V2, P> const & v2
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat2x4<T, P>::tmat2x4(tvec4<V1, P> const & v1, tvec4<V2, P> const & v2)
|
||||
{
|
||||
this->value[0] = col_type(v1);
|
||||
this->value[1] = col_type(v2);
|
||||
@ -164,100 +111,119 @@ namespace detail
|
||||
|
||||
template <typename T, precision P>
|
||||
template <typename U, precision Q>
|
||||
GLM_FUNC_QUALIFIER tmat2x4<T, P>::tmat2x4
|
||||
(
|
||||
tmat2x4<U, Q> const & m
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat2x4<T, P>::tmat2x4(tmat2x4<U, Q> const & m)
|
||||
{
|
||||
this->value[0] = col_type(m[0]);
|
||||
this->value[1] = col_type(m[1]);
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat2x4<T, P>::tmat2x4
|
||||
(
|
||||
tmat2x2<T, P> const & m
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat2x4<T, P>::tmat2x4(tmat2x2<T, P> const & m)
|
||||
{
|
||||
this->value[0] = col_type(m[0], detail::tvec2<T, P>(0));
|
||||
this->value[1] = col_type(m[1], detail::tvec2<T, P>(0));
|
||||
this->value[0] = col_type(m[0], 0, 0);
|
||||
this->value[1] = col_type(m[1], 0, 0);
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat2x4<T, P>::tmat2x4
|
||||
(
|
||||
tmat3x3<T, P> const & m
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat2x4<T, P>::tmat2x4(tmat3x3<T, P> const & m)
|
||||
{
|
||||
this->value[0] = col_type(m[0], T(0));
|
||||
this->value[1] = col_type(m[1], T(0));
|
||||
this->value[0] = col_type(m[0], 0);
|
||||
this->value[1] = col_type(m[1], 0);
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat2x4<T, P>::tmat2x4
|
||||
(
|
||||
tmat4x4<T, P> const & m
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat2x4<T, P>::tmat2x4(tmat4x4<T, P> const & m)
|
||||
{
|
||||
this->value[0] = col_type(m[0]);
|
||||
this->value[1] = col_type(m[1]);
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat2x4<T, P>::tmat2x4
|
||||
(
|
||||
tmat2x3<T, P> const & m
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat2x4<T, P>::tmat2x4(tmat2x3<T, P> const & m)
|
||||
{
|
||||
this->value[0] = col_type(m[0], T(0));
|
||||
this->value[1] = col_type(m[1], T(0));
|
||||
this->value[0] = col_type(m[0], 0);
|
||||
this->value[1] = col_type(m[1], 0);
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat2x4<T, P>::tmat2x4
|
||||
(
|
||||
tmat3x2<T, P> const & m
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat2x4<T, P>::tmat2x4(tmat3x2<T, P> const & m)
|
||||
{
|
||||
this->value[0] = col_type(m[0], detail::tvec2<T, P>(0));
|
||||
this->value[1] = col_type(m[1], detail::tvec2<T, P>(0));
|
||||
this->value[0] = col_type(m[0], 0, 0);
|
||||
this->value[1] = col_type(m[1], 0, 0);
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat2x4<T, P>::tmat2x4
|
||||
(
|
||||
tmat3x4<T, P> const & m
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat2x4<T, P>::tmat2x4(tmat3x4<T, P> const & m)
|
||||
{
|
||||
this->value[0] = m[0];
|
||||
this->value[1] = m[1];
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat2x4<T, P>::tmat2x4
|
||||
(
|
||||
tmat4x2<T, P> const & m
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat2x4<T, P>::tmat2x4(tmat4x2<T, P> const & m)
|
||||
{
|
||||
this->value[0] = col_type(m[0], detail::tvec2<T, P>(T(0)));
|
||||
this->value[1] = col_type(m[1], detail::tvec2<T, P>(T(0)));
|
||||
this->value[0] = col_type(m[0], 0, 0);
|
||||
this->value[1] = col_type(m[1], 0, 0);
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat2x4<T, P>::tmat2x4
|
||||
(
|
||||
tmat4x3<T, P> const & m
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat2x4<T, P>::tmat2x4(tmat4x3<T, P> const & m)
|
||||
{
|
||||
this->value[0] = col_type(m[0], T(0));
|
||||
this->value[1] = col_type(m[1], T(0));
|
||||
this->value[0] = col_type(m[0], 0);
|
||||
this->value[1] = col_type(m[1], 0);
|
||||
}
|
||||
|
||||
//////////////////////////////////////
|
||||
// Accesses
|
||||
|
||||
# ifdef GLM_FORCE_SIZE_FUNC
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tmat2x4<T, P>::size_type tmat2x4<T, P>::size() const
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER typename tmat2x4<T, P>::col_type & tmat2x4<T, P>::operator[](typename tmat2x4<T, P>::size_type i)
|
||||
{
|
||||
assert(i < this->size());
|
||||
return this->value[i];
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER typename tmat2x4<T, P>::col_type const & tmat2x4<T, P>::operator[](typename tmat2x4<T, P>::size_type i) const
|
||||
{
|
||||
assert(i < this->size());
|
||||
return this->value[i];
|
||||
}
|
||||
# else
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tmat2x4<T, P>::length_type tmat2x4<T, P>::length() const
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER typename tmat2x4<T, P>::col_type & tmat2x4<T, P>::operator[](typename tmat2x4<T, P>::length_type i)
|
||||
{
|
||||
assert(i < this->length());
|
||||
return this->value[i];
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER typename tmat2x4<T, P>::col_type const & tmat2x4<T, P>::operator[](typename tmat2x4<T, P>::length_type i) const
|
||||
{
|
||||
assert(i < this->length());
|
||||
return this->value[i];
|
||||
}
|
||||
# endif//GLM_FORCE_SIZE_FUNC
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
// Unary updatable operators
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat2x4<T, P>& tmat2x4<T, P>::operator= (tmat2x4<T, P> const & m)
|
||||
template <typename U>
|
||||
GLM_FUNC_QUALIFIER tmat2x4<T, P>& tmat2x4<T, P>::operator=(tmat2x4<U, P> const & m)
|
||||
{
|
||||
this->value[0] = m[0];
|
||||
this->value[1] = m[1];
|
||||
@ -266,16 +232,7 @@ namespace detail
|
||||
|
||||
template <typename T, precision P>
|
||||
template <typename U>
|
||||
GLM_FUNC_QUALIFIER tmat2x4<T, P>& tmat2x4<T, P>::operator= (tmat2x4<U, P> const & m)
|
||||
{
|
||||
this->value[0] = m[0];
|
||||
this->value[1] = m[1];
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
template <typename U>
|
||||
GLM_FUNC_QUALIFIER tmat2x4<T, P>& tmat2x4<T, P>::operator+= (U s)
|
||||
GLM_FUNC_QUALIFIER tmat2x4<T, P>& tmat2x4<T, P>::operator+=(U s)
|
||||
{
|
||||
this->value[0] += s;
|
||||
this->value[1] += s;
|
||||
@ -284,7 +241,7 @@ namespace detail
|
||||
|
||||
template <typename T, precision P>
|
||||
template <typename U>
|
||||
GLM_FUNC_QUALIFIER tmat2x4<T, P>& tmat2x4<T, P>::operator+= (tmat2x4<U, P> const & m)
|
||||
GLM_FUNC_QUALIFIER tmat2x4<T, P>& tmat2x4<T, P>::operator+=(tmat2x4<U, P> const & m)
|
||||
{
|
||||
this->value[0] += m[0];
|
||||
this->value[1] += m[1];
|
||||
@ -293,7 +250,7 @@ namespace detail
|
||||
|
||||
template <typename T, precision P>
|
||||
template <typename U>
|
||||
GLM_FUNC_QUALIFIER tmat2x4<T, P>& tmat2x4<T, P>::operator-= (U s)
|
||||
GLM_FUNC_QUALIFIER tmat2x4<T, P>& tmat2x4<T, P>::operator-=(U s)
|
||||
{
|
||||
this->value[0] -= s;
|
||||
this->value[1] -= s;
|
||||
@ -302,7 +259,7 @@ namespace detail
|
||||
|
||||
template <typename T, precision P>
|
||||
template <typename U>
|
||||
GLM_FUNC_QUALIFIER tmat2x4<T, P>& tmat2x4<T, P>::operator-= (tmat2x4<U, P> const & m)
|
||||
GLM_FUNC_QUALIFIER tmat2x4<T, P>& tmat2x4<T, P>::operator-=(tmat2x4<U, P> const & m)
|
||||
{
|
||||
this->value[0] -= m[0];
|
||||
this->value[1] -= m[1];
|
||||
@ -311,7 +268,7 @@ namespace detail
|
||||
|
||||
template <typename T, precision P>
|
||||
template <typename U>
|
||||
GLM_FUNC_QUALIFIER tmat2x4<T, P>& tmat2x4<T, P>::operator*= (U s)
|
||||
GLM_FUNC_QUALIFIER tmat2x4<T, P>& tmat2x4<T, P>::operator*=(U s)
|
||||
{
|
||||
this->value[0] *= s;
|
||||
this->value[1] *= s;
|
||||
@ -320,7 +277,7 @@ namespace detail
|
||||
|
||||
template <typename T, precision P>
|
||||
template <typename U>
|
||||
GLM_FUNC_QUALIFIER tmat2x4<T, P> & tmat2x4<T, P>::operator/= (U s)
|
||||
GLM_FUNC_QUALIFIER tmat2x4<T, P> & tmat2x4<T, P>::operator/=(U s)
|
||||
{
|
||||
this->value[0] /= s;
|
||||
this->value[1] /= s;
|
||||
@ -363,11 +320,7 @@ namespace detail
|
||||
// Binary operators
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat2x4<T, P> operator+
|
||||
(
|
||||
tmat2x4<T, P> const & m,
|
||||
T const & s
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat2x4<T, P> operator+(tmat2x4<T, P> const & m, T const & s)
|
||||
{
|
||||
return tmat2x4<T, P>(
|
||||
m[0] + s,
|
||||
@ -375,11 +328,7 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat2x4<T, P> operator+
|
||||
(
|
||||
tmat2x4<T, P> const & m1,
|
||||
tmat2x4<T, P> const & m2
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat2x4<T, P> operator+(tmat2x4<T, P> const & m1, tmat2x4<T, P> const & m2)
|
||||
{
|
||||
return tmat2x4<T, P>(
|
||||
m1[0] + m2[0],
|
||||
@ -387,11 +336,7 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat2x4<T, P> operator-
|
||||
(
|
||||
tmat2x4<T, P> const & m,
|
||||
T const & s
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat2x4<T, P> operator-(tmat2x4<T, P> const & m, T const & s)
|
||||
{
|
||||
return tmat2x4<T, P>(
|
||||
m[0] - s,
|
||||
@ -399,11 +344,7 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat2x4<T, P> operator-
|
||||
(
|
||||
tmat2x4<T, P> const & m1,
|
||||
tmat2x4<T, P> const & m2
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat2x4<T, P> operator-(tmat2x4<T, P> const & m1, tmat2x4<T, P> const & m2)
|
||||
{
|
||||
return tmat2x4<T, P>(
|
||||
m1[0] - m2[0],
|
||||
@ -411,11 +352,7 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat2x4<T, P> operator*
|
||||
(
|
||||
tmat2x4<T, P> const & m,
|
||||
T const & s
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat2x4<T, P> operator*(tmat2x4<T, P> const & m, T const & s)
|
||||
{
|
||||
return tmat2x4<T, P>(
|
||||
m[0] * s,
|
||||
@ -423,11 +360,7 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat2x4<T, P> operator*
|
||||
(
|
||||
T const & s,
|
||||
tmat2x4<T, P> const & m
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat2x4<T, P> operator*(T const & s, tmat2x4<T, P> const & m)
|
||||
{
|
||||
return tmat2x4<T, P>(
|
||||
m[0] * s,
|
||||
@ -435,11 +368,7 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER typename tmat2x4<T, P>::col_type operator*
|
||||
(
|
||||
tmat2x4<T, P> const & m,
|
||||
typename tmat2x4<T, P>::row_type const & v
|
||||
)
|
||||
GLM_FUNC_QUALIFIER typename tmat2x4<T, P>::col_type operator*(tmat2x4<T, P> const & m, typename tmat2x4<T, P>::row_type const & v)
|
||||
{
|
||||
return typename tmat2x4<T, P>::col_type(
|
||||
m[0][0] * v.x + m[1][0] * v.y,
|
||||
@ -449,11 +378,7 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER typename tmat2x4<T, P>::row_type operator*
|
||||
(
|
||||
typename tmat2x4<T, P>::col_type const & v,
|
||||
tmat2x4<T, P> const & m
|
||||
)
|
||||
GLM_FUNC_QUALIFIER typename tmat2x4<T, P>::row_type operator*(typename tmat2x4<T, P>::col_type const & v, tmat2x4<T, P> const & m)
|
||||
{
|
||||
return typename tmat2x4<T, P>::row_type(
|
||||
v.x * m[0][0] + v.y * m[0][1] + v.z * m[0][2] + v.w * m[0][3],
|
||||
@ -461,11 +386,7 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat4x4<T, P> operator*
|
||||
(
|
||||
tmat2x4<T, P> const & m1,
|
||||
tmat4x2<T, P> const & m2
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat4x4<T, P> operator*(tmat2x4<T, P> const & m1, tmat4x2<T, P> const & m2)
|
||||
{
|
||||
T SrcA00 = m1[0][0];
|
||||
T SrcA01 = m1[0][1];
|
||||
@ -485,7 +406,7 @@ namespace detail
|
||||
T SrcB30 = m2[3][0];
|
||||
T SrcB31 = m2[3][1];
|
||||
|
||||
tmat4x4<T, P> Result(tmat4x4<T, P>::_null);
|
||||
tmat4x4<T, P> Result(uninitialize);
|
||||
Result[0][0] = SrcA00 * SrcB00 + SrcA10 * SrcB01;
|
||||
Result[0][1] = SrcA01 * SrcB00 + SrcA11 * SrcB01;
|
||||
Result[0][2] = SrcA02 * SrcB00 + SrcA12 * SrcB01;
|
||||
@ -506,11 +427,7 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat2x4<T, P> operator*
|
||||
(
|
||||
tmat2x4<T, P> const & m1,
|
||||
tmat2x2<T, P> const & m2
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat2x4<T, P> operator*(tmat2x4<T, P> const & m1, tmat2x2<T, P> const & m2)
|
||||
{
|
||||
return tmat2x4<T, P>(
|
||||
m1[0][0] * m2[0][0] + m1[1][0] * m2[0][1],
|
||||
@ -524,11 +441,7 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat3x4<T, P> operator*
|
||||
(
|
||||
tmat2x4<T, P> const & m1,
|
||||
tmat3x2<T, P> const & m2
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat3x4<T, P> operator*(tmat2x4<T, P> const & m1, tmat3x2<T, P> const & m2)
|
||||
{
|
||||
return tmat3x4<T, P>(
|
||||
m1[0][0] * m2[0][0] + m1[1][0] * m2[0][1],
|
||||
@ -546,11 +459,7 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat2x4<T, P> operator/
|
||||
(
|
||||
tmat2x4<T, P> const & m,
|
||||
T const & s
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat2x4<T, P> operator/(tmat2x4<T, P> const & m, T s)
|
||||
{
|
||||
return tmat2x4<T, P>(
|
||||
m[0] / s,
|
||||
@ -558,11 +467,7 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat2x4<T, P> operator/
|
||||
(
|
||||
T const & s,
|
||||
tmat2x4<T, P> const & m
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat2x4<T, P> operator/(T s, tmat2x4<T, P> const & m)
|
||||
{
|
||||
return tmat2x4<T, P>(
|
||||
s / m[0],
|
||||
@ -571,10 +476,7 @@ namespace detail
|
||||
|
||||
// Unary constant operators
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat2x4<T, P> const operator-
|
||||
(
|
||||
tmat2x4<T, P> const & m
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat2x4<T, P> const operator-(tmat2x4<T, P> const & m)
|
||||
{
|
||||
return tmat2x4<T, P>(
|
||||
-m[0],
|
||||
@ -585,23 +487,14 @@ namespace detail
|
||||
// Boolean operators
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER bool operator==
|
||||
(
|
||||
tmat2x4<T, P> const & m1,
|
||||
tmat2x4<T, P> const & m2
|
||||
)
|
||||
GLM_FUNC_QUALIFIER bool operator==(tmat2x4<T, P> const & m1, tmat2x4<T, P> const & m2)
|
||||
{
|
||||
return (m1[0] == m2[0]) && (m1[1] == m2[1]);
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER bool operator!=
|
||||
(
|
||||
tmat2x4<T, P> const & m1,
|
||||
tmat2x4<T, P> const & m2
|
||||
)
|
||||
GLM_FUNC_QUALIFIER bool operator!=(tmat2x4<T, P> const & m1, tmat2x4<T, P> const & m2)
|
||||
{
|
||||
return (m1[0] != m2[0]) || (m1[1] != m2[1]);
|
||||
}
|
||||
} //namespace detail
|
||||
} //namespace glm
|
||||
|
||||
@ -12,6 +12,10 @@
|
||||
/// 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
|
||||
@ -21,51 +25,44 @@
|
||||
/// THE SOFTWARE.
|
||||
///
|
||||
/// @ref core
|
||||
/// @file glm/core/type_mat3x2.hpp
|
||||
/// @file glm/detail/type_mat3x2.hpp
|
||||
/// @date 2006-08-05 / 2011-06-15
|
||||
/// @author Christophe Riccio
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef glm_core_type_mat3x2
|
||||
#define glm_core_type_mat3x2
|
||||
#pragma once
|
||||
|
||||
#include "../fwd.hpp"
|
||||
#include "type_vec2.hpp"
|
||||
#include "type_vec3.hpp"
|
||||
#include "type_mat.hpp"
|
||||
#include <limits>
|
||||
#include <cstddef>
|
||||
|
||||
namespace glm{
|
||||
namespace detail
|
||||
namespace glm
|
||||
{
|
||||
template <typename T, precision P>
|
||||
template <typename T, precision P = defaultp>
|
||||
struct tmat3x2
|
||||
{
|
||||
enum ctor{_null};
|
||||
typedef T value_type;
|
||||
typedef std::size_t size_type;
|
||||
typedef tvec2<T, P> col_type;
|
||||
typedef tvec3<T, P> row_type;
|
||||
typedef tmat3x2<T, P> type;
|
||||
typedef tmat2x3<T, P> transpose_type;
|
||||
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const;
|
||||
typedef T value_type;
|
||||
|
||||
private:
|
||||
// Data
|
||||
/// @cond DETAIL
|
||||
col_type value[3];
|
||||
|
||||
/// @endcond
|
||||
|
||||
public:
|
||||
// Constructors
|
||||
GLM_FUNC_DECL tmat3x2();
|
||||
GLM_FUNC_DECL tmat3x2(tmat3x2<T, P> const & m);
|
||||
template <precision Q>
|
||||
GLM_FUNC_DECL tmat3x2(tmat3x2<T, Q> const & m);
|
||||
|
||||
GLM_FUNC_DECL explicit tmat3x2(
|
||||
ctor);
|
||||
GLM_FUNC_DECL explicit tmat3x2(
|
||||
T const & s);
|
||||
GLM_FUNC_DECL explicit tmat3x2(ctor);
|
||||
GLM_FUNC_DECL explicit tmat3x2(T const & s);
|
||||
GLM_FUNC_DECL tmat3x2(
|
||||
T const & x0, T const & y0,
|
||||
T const & x1, T const & y1,
|
||||
@ -77,6 +74,7 @@ namespace detail
|
||||
|
||||
//////////////////////////////////////
|
||||
// Conversions
|
||||
|
||||
template<
|
||||
typename X1, typename Y1,
|
||||
typename X2, typename Y2,
|
||||
@ -92,9 +90,16 @@ namespace detail
|
||||
tvec2<V2, P> const & v2,
|
||||
tvec2<V3, P> const & v3);
|
||||
|
||||
//////////////////////////////////////
|
||||
// Matrix conversions
|
||||
template <typename U, precision Q>
|
||||
GLM_FUNC_DECL explicit tmat3x2(tmat3x2<U, Q> const & m);
|
||||
|
||||
# ifdef GLM_FORCE_EXPLICIT_CTOR
|
||||
template <typename U, precision Q>
|
||||
GLM_FUNC_DECL explicit tmat3x2(tmat3x2<U, Q> const & m);
|
||||
# else
|
||||
template <typename U, precision Q>
|
||||
GLM_FUNC_DECL tmat3x2(tmat3x2<U, Q> const & m);
|
||||
# endif
|
||||
|
||||
GLM_FUNC_DECL explicit tmat3x2(tmat2x2<T, P> const & x);
|
||||
GLM_FUNC_DECL explicit tmat3x2(tmat3x3<T, P> const & x);
|
||||
@ -105,12 +110,26 @@ namespace detail
|
||||
GLM_FUNC_DECL explicit tmat3x2(tmat4x2<T, P> const & x);
|
||||
GLM_FUNC_DECL explicit tmat3x2(tmat4x3<T, P> const & x);
|
||||
|
||||
//////////////////////////////////////
|
||||
// Accesses
|
||||
GLM_FUNC_DECL col_type & operator[](length_t i);
|
||||
GLM_FUNC_DECL col_type const & operator[](length_t i) const;
|
||||
|
||||
// Unary updatable operators
|
||||
GLM_FUNC_DECL tmat3x2<T, P> & operator= (tmat3x2<T, P> const & m);
|
||||
# ifdef GLM_FORCE_SIZE_FUNC
|
||||
typedef size_t size_type;
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR size_t size() const;
|
||||
|
||||
GLM_FUNC_DECL col_type & operator[](size_type i);
|
||||
GLM_FUNC_DECL col_type const & operator[](size_type i) const;
|
||||
# else
|
||||
typedef length_t length_type;
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR length_type length() const;
|
||||
|
||||
GLM_FUNC_DECL col_type & operator[](length_type i);
|
||||
GLM_FUNC_DECL col_type const & operator[](length_type i) const;
|
||||
# endif//GLM_FORCE_SIZE_FUNC
|
||||
|
||||
//////////////////////////////////////
|
||||
// Unary arithmetic operators
|
||||
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tmat3x2<T, P> & operator= (tmat3x2<U, P> const & m);
|
||||
template <typename U>
|
||||
@ -205,12 +224,8 @@ namespace detail
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tmat3x2<T, P> const operator-(
|
||||
tmat3x2<T, P> const & m);
|
||||
|
||||
}//namespace detail
|
||||
}//namespace glm
|
||||
|
||||
#ifndef GLM_EXTERNAL_TEMPLATE
|
||||
#include "type_mat3x2.inl"
|
||||
#endif
|
||||
|
||||
#endif //glm_core_type_mat3x2
|
||||
|
||||
@ -12,6 +12,10 @@
|
||||
/// 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
|
||||
@ -21,71 +25,29 @@
|
||||
/// THE SOFTWARE.
|
||||
///
|
||||
/// @ref core
|
||||
/// @file glm/core/type_mat3x2.inl
|
||||
/// @file glm/detail/type_mat3x2.inl
|
||||
/// @date 2006-08-05 / 2011-06-15
|
||||
/// @author Christophe Riccio
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
namespace glm{
|
||||
namespace detail
|
||||
namespace glm
|
||||
{
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR length_t tmat3x2<T, P>::length() const
|
||||
{
|
||||
return 3;
|
||||
}
|
||||
|
||||
//////////////////////////////////////
|
||||
// Accesses
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER typename tmat3x2<T, P>::col_type &
|
||||
tmat3x2<T, P>::operator[]
|
||||
(
|
||||
length_t i
|
||||
)
|
||||
{
|
||||
assert(i < this->length());
|
||||
return this->value[i];
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER typename tmat3x2<T, P>::col_type const &
|
||||
tmat3x2<T, P>::operator[]
|
||||
(
|
||||
length_t i
|
||||
) const
|
||||
{
|
||||
assert(i < this->length());
|
||||
return this->value[i];
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
// Constructors
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat3x2<T, P>::tmat3x2()
|
||||
{
|
||||
this->value[0] = col_type(1, 0);
|
||||
this->value[1] = col_type(0, 1);
|
||||
this->value[2] = col_type(0, 0);
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat3x2<T, P>::tmat3x2
|
||||
(
|
||||
tmat3x2<T, P> const & m
|
||||
)
|
||||
{
|
||||
this->value[0] = m.value[0];
|
||||
this->value[1] = m.value[1];
|
||||
this->value[2] = m.value[2];
|
||||
# ifndef GLM_FORCE_NO_CTOR_INIT
|
||||
this->value[0] = col_type(1, 0);
|
||||
this->value[1] = col_type(0, 1);
|
||||
this->value[2] = col_type(0, 0);
|
||||
# endif
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
template <precision Q>
|
||||
GLM_FUNC_QUALIFIER tmat3x2<T, P>::tmat3x2(
|
||||
tmat3x2<T, Q> const & m)
|
||||
GLM_FUNC_QUALIFIER tmat3x2<T, P>::tmat3x2(tmat3x2<T, Q> const & m)
|
||||
{
|
||||
this->value[0] = m.value[0];
|
||||
this->value[1] = m.value[1];
|
||||
@ -93,17 +55,11 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat3x2<T, P>::tmat3x2
|
||||
(
|
||||
ctor
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat3x2<T, P>::tmat3x2(ctor)
|
||||
{}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat3x2<T, P>::tmat3x2
|
||||
(
|
||||
T const & s
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat3x2<T, P>::tmat3x2(T const & s)
|
||||
{
|
||||
this->value[0] = col_type(s, 0);
|
||||
this->value[1] = col_type(0, s);
|
||||
@ -174,10 +130,7 @@ namespace detail
|
||||
|
||||
template <typename T, precision P>
|
||||
template <typename U, precision Q>
|
||||
GLM_FUNC_QUALIFIER tmat3x2<T, P>::tmat3x2
|
||||
(
|
||||
tmat3x2<U, Q> const & m
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat3x2<T, P>::tmat3x2(tmat3x2<U, Q> const & m)
|
||||
{
|
||||
this->value[0] = col_type(m[0]);
|
||||
this->value[1] = col_type(m[1]);
|
||||
@ -185,21 +138,15 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat3x2<T, P>::tmat3x2
|
||||
(
|
||||
tmat2x2<T, P> const & m
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat3x2<T, P>::tmat3x2(tmat2x2<T, P> const & m)
|
||||
{
|
||||
this->value[0] = m[0];
|
||||
this->value[1] = m[1];
|
||||
this->value[2] = col_type(T(0));
|
||||
this->value[2] = col_type(0);
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat3x2<T, P>::tmat3x2
|
||||
(
|
||||
tmat3x3<T, P> const & m
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat3x2<T, P>::tmat3x2(tmat3x3<T, P> const & m)
|
||||
{
|
||||
this->value[0] = col_type(m[0]);
|
||||
this->value[1] = col_type(m[1]);
|
||||
@ -207,10 +154,7 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat3x2<T, P>::tmat3x2
|
||||
(
|
||||
tmat4x4<T, P> const & m
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat3x2<T, P>::tmat3x2(tmat4x4<T, P> const & m)
|
||||
{
|
||||
this->value[0] = col_type(m[0]);
|
||||
this->value[1] = col_type(m[1]);
|
||||
@ -218,10 +162,7 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat3x2<T, P>::tmat3x2
|
||||
(
|
||||
tmat2x3<T, P> const & m
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat3x2<T, P>::tmat3x2(tmat2x3<T, P> const & m)
|
||||
{
|
||||
this->value[0] = col_type(m[0]);
|
||||
this->value[1] = col_type(m[1]);
|
||||
@ -229,10 +170,7 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat3x2<T, P>::tmat3x2
|
||||
(
|
||||
tmat2x4<T, P> const & m
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat3x2<T, P>::tmat3x2(tmat2x4<T, P> const & m)
|
||||
{
|
||||
this->value[0] = col_type(m[0]);
|
||||
this->value[1] = col_type(m[1]);
|
||||
@ -240,10 +178,7 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat3x2<T, P>::tmat3x2
|
||||
(
|
||||
tmat3x4<T, P> const & m
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat3x2<T, P>::tmat3x2(tmat3x4<T, P> const & m)
|
||||
{
|
||||
this->value[0] = col_type(m[0]);
|
||||
this->value[1] = col_type(m[1]);
|
||||
@ -251,10 +186,7 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat3x2<T, P>::tmat3x2
|
||||
(
|
||||
tmat4x2<T, P> const & m
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat3x2<T, P>::tmat3x2(tmat4x2<T, P> const & m)
|
||||
{
|
||||
this->value[0] = m[0];
|
||||
this->value[1] = m[1];
|
||||
@ -262,21 +194,64 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat3x2<T, P>::tmat3x2
|
||||
(
|
||||
tmat4x3<T, P> const & m
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat3x2<T, P>::tmat3x2(tmat4x3<T, P> const & m)
|
||||
{
|
||||
this->value[0] = col_type(m[0]);
|
||||
this->value[1] = col_type(m[1]);
|
||||
this->value[2] = col_type(m[2]);
|
||||
}
|
||||
|
||||
//////////////////////////////////////
|
||||
// Accesses
|
||||
|
||||
# ifdef GLM_FORCE_SIZE_FUNC
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tmat3x2<T, P>::size_type tmat3x2<T, P>::size() const
|
||||
{
|
||||
return 3;
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER typename tmat3x2<T, P>::col_type & tmat3x2<T, P>::operator[](typename tmat3x2<T, P>::size_type i)
|
||||
{
|
||||
assert(i < this->size());
|
||||
return this->value[i];
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER typename tmat3x2<T, P>::col_type const & tmat3x2<T, P>::operator[](typename tmat3x2<T, P>::size_type i) const
|
||||
{
|
||||
assert(i < this->size());
|
||||
return this->value[i];
|
||||
}
|
||||
# else
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tmat3x2<T, P>::length_type tmat3x2<T, P>::length() const
|
||||
{
|
||||
return 3;
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER typename tmat3x2<T, P>::col_type & tmat3x2<T, P>::operator[](typename tmat3x2<T, P>::length_type i)
|
||||
{
|
||||
assert(i < this->length());
|
||||
return this->value[i];
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER typename tmat3x2<T, P>::col_type const & tmat3x2<T, P>::operator[](typename tmat3x2<T, P>::length_type i) const
|
||||
{
|
||||
assert(i < this->length());
|
||||
return this->value[i];
|
||||
}
|
||||
# endif//GLM_FORCE_SIZE_FUNC
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
// Unary updatable operators
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat3x2<T, P>& tmat3x2<T, P>::operator= (tmat3x2<T, P> const & m)
|
||||
template <typename T, precision P>
|
||||
template <typename U>
|
||||
GLM_FUNC_QUALIFIER tmat3x2<T, P>& tmat3x2<T, P>::operator=(tmat3x2<U, P> const & m)
|
||||
{
|
||||
this->value[0] = m[0];
|
||||
this->value[1] = m[1];
|
||||
@ -286,17 +261,7 @@ namespace detail
|
||||
|
||||
template <typename T, precision P>
|
||||
template <typename U>
|
||||
GLM_FUNC_QUALIFIER tmat3x2<T, P>& tmat3x2<T, P>::operator= (tmat3x2<U, P> const & m)
|
||||
{
|
||||
this->value[0] = m[0];
|
||||
this->value[1] = m[1];
|
||||
this->value[2] = m[2];
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
template <typename U>
|
||||
GLM_FUNC_QUALIFIER tmat3x2<T, P>& tmat3x2<T, P>::operator+= (U s)
|
||||
GLM_FUNC_QUALIFIER tmat3x2<T, P>& tmat3x2<T, P>::operator+=(U s)
|
||||
{
|
||||
this->value[0] += s;
|
||||
this->value[1] += s;
|
||||
@ -306,7 +271,7 @@ namespace detail
|
||||
|
||||
template <typename T, precision P>
|
||||
template <typename U>
|
||||
GLM_FUNC_QUALIFIER tmat3x2<T, P>& tmat3x2<T, P>::operator+= (tmat3x2<U, P> const & m)
|
||||
GLM_FUNC_QUALIFIER tmat3x2<T, P>& tmat3x2<T, P>::operator+=(tmat3x2<U, P> const & m)
|
||||
{
|
||||
this->value[0] += m[0];
|
||||
this->value[1] += m[1];
|
||||
@ -316,7 +281,7 @@ namespace detail
|
||||
|
||||
template <typename T, precision P>
|
||||
template <typename U>
|
||||
GLM_FUNC_QUALIFIER tmat3x2<T, P>& tmat3x2<T, P>::operator-= (U s)
|
||||
GLM_FUNC_QUALIFIER tmat3x2<T, P>& tmat3x2<T, P>::operator-=(U s)
|
||||
{
|
||||
this->value[0] -= s;
|
||||
this->value[1] -= s;
|
||||
@ -326,7 +291,7 @@ namespace detail
|
||||
|
||||
template <typename T, precision P>
|
||||
template <typename U>
|
||||
GLM_FUNC_QUALIFIER tmat3x2<T, P>& tmat3x2<T, P>::operator-= (tmat3x2<U, P> const & m)
|
||||
GLM_FUNC_QUALIFIER tmat3x2<T, P>& tmat3x2<T, P>::operator-=(tmat3x2<U, P> const & m)
|
||||
{
|
||||
this->value[0] -= m[0];
|
||||
this->value[1] -= m[1];
|
||||
@ -336,7 +301,7 @@ namespace detail
|
||||
|
||||
template <typename T, precision P>
|
||||
template <typename U>
|
||||
GLM_FUNC_QUALIFIER tmat3x2<T, P>& tmat3x2<T, P>::operator*= (U s)
|
||||
GLM_FUNC_QUALIFIER tmat3x2<T, P>& tmat3x2<T, P>::operator*=(U s)
|
||||
{
|
||||
this->value[0] *= s;
|
||||
this->value[1] *= s;
|
||||
@ -346,7 +311,7 @@ namespace detail
|
||||
|
||||
template <typename T, precision P>
|
||||
template <typename U>
|
||||
GLM_FUNC_QUALIFIER tmat3x2<T, P> & tmat3x2<T, P>::operator/= (U s)
|
||||
GLM_FUNC_QUALIFIER tmat3x2<T, P> & tmat3x2<T, P>::operator/=(U s)
|
||||
{
|
||||
this->value[0] /= s;
|
||||
this->value[1] /= s;
|
||||
@ -355,7 +320,7 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat3x2<T, P>& tmat3x2<T, P>::operator++ ()
|
||||
GLM_FUNC_QUALIFIER tmat3x2<T, P>& tmat3x2<T, P>::operator++()
|
||||
{
|
||||
++this->value[0];
|
||||
++this->value[1];
|
||||
@ -364,7 +329,7 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat3x2<T, P>& tmat3x2<T, P>::operator-- ()
|
||||
GLM_FUNC_QUALIFIER tmat3x2<T, P>& tmat3x2<T, P>::operator--()
|
||||
{
|
||||
--this->value[0];
|
||||
--this->value[1];
|
||||
@ -392,11 +357,7 @@ namespace detail
|
||||
// Binary operators
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat3x2<T, P> operator+
|
||||
(
|
||||
tmat3x2<T, P> const & m,
|
||||
T const & s
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat3x2<T, P> operator+(tmat3x2<T, P> const & m, T const & s)
|
||||
{
|
||||
return tmat3x2<T, P>(
|
||||
m[0] + s,
|
||||
@ -405,11 +366,7 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat3x2<T, P> operator+
|
||||
(
|
||||
tmat3x2<T, P> const & m1,
|
||||
tmat3x2<T, P> const & m2
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat3x2<T, P> operator+(tmat3x2<T, P> const & m1, tmat3x2<T, P> const & m2)
|
||||
{
|
||||
return tmat3x2<T, P>(
|
||||
m1[0] + m2[0],
|
||||
@ -418,11 +375,7 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat3x2<T, P> operator-
|
||||
(
|
||||
tmat3x2<T, P> const & m,
|
||||
T const & s
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat3x2<T, P> operator-(tmat3x2<T, P> const & m, T const & s)
|
||||
{
|
||||
return tmat3x2<T, P>(
|
||||
m[0] - s,
|
||||
@ -431,11 +384,7 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat3x2<T, P> operator-
|
||||
(
|
||||
tmat3x2<T, P> const & m1,
|
||||
tmat3x2<T, P> const & m2
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat3x2<T, P> operator-(tmat3x2<T, P> const & m1, tmat3x2<T, P> const & m2)
|
||||
{
|
||||
return tmat3x2<T, P>(
|
||||
m1[0] - m2[0],
|
||||
@ -444,11 +393,7 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat3x2<T, P> operator*
|
||||
(
|
||||
tmat3x2<T, P> const & m,
|
||||
T const & s
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat3x2<T, P> operator*(tmat3x2<T, P> const & m, T const & s)
|
||||
{
|
||||
return tmat3x2<T, P>(
|
||||
m[0] * s,
|
||||
@ -457,11 +402,7 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat3x2<T, P> operator*
|
||||
(
|
||||
T const & s,
|
||||
tmat3x2<T, P> const & m
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat3x2<T, P> operator*(T const & s, tmat3x2<T, P> const & m)
|
||||
{
|
||||
return tmat3x2<T, P>(
|
||||
m[0] * s,
|
||||
@ -470,10 +411,7 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER typename tmat3x2<T, P>::col_type operator*
|
||||
(
|
||||
tmat3x2<T, P> const & m,
|
||||
typename tmat3x2<T, P>::row_type const & v)
|
||||
GLM_FUNC_QUALIFIER typename tmat3x2<T, P>::col_type operator*(tmat3x2<T, P> const & m, typename tmat3x2<T, P>::row_type const & v)
|
||||
{
|
||||
return typename tmat3x2<T, P>::col_type(
|
||||
m[0][0] * v.x + m[1][0] * v.y + m[2][0] * v.z,
|
||||
@ -481,10 +419,7 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER typename tmat3x2<T, P>::row_type operator*
|
||||
(
|
||||
typename tmat3x2<T, P>::col_type const & v,
|
||||
tmat3x2<T, P> const & m)
|
||||
GLM_FUNC_QUALIFIER typename tmat3x2<T, P>::row_type operator*(typename tmat3x2<T, P>::col_type const & v, tmat3x2<T, P> const & m)
|
||||
{
|
||||
return typename tmat3x2<T, P>::row_type(
|
||||
v.x * m[0][0] + v.y * m[0][1],
|
||||
@ -493,11 +428,7 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat2x2<T, P> operator*
|
||||
(
|
||||
tmat3x2<T, P> const & m1,
|
||||
tmat2x3<T, P> const & m2
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat2x2<T, P> operator*(tmat3x2<T, P> const & m1, tmat2x3<T, P> const & m2)
|
||||
{
|
||||
const T SrcA00 = m1[0][0];
|
||||
const T SrcA01 = m1[0][1];
|
||||
@ -513,7 +444,7 @@ namespace detail
|
||||
const T SrcB11 = m2[1][1];
|
||||
const T SrcB12 = m2[1][2];
|
||||
|
||||
tmat2x2<T, P> Result(tmat2x2<T, P>::_null);
|
||||
tmat2x2<T, P> Result(uninitialize);
|
||||
Result[0][0] = SrcA00 * SrcB00 + SrcA10 * SrcB01 + SrcA20 * SrcB02;
|
||||
Result[0][1] = SrcA01 * SrcB00 + SrcA11 * SrcB01 + SrcA21 * SrcB02;
|
||||
Result[1][0] = SrcA00 * SrcB10 + SrcA10 * SrcB11 + SrcA20 * SrcB12;
|
||||
@ -522,11 +453,7 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat3x2<T, P> operator*
|
||||
(
|
||||
tmat3x2<T, P> const & m1,
|
||||
tmat3x3<T, P> const & m2
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat3x2<T, P> operator*(tmat3x2<T, P> const & m1, tmat3x3<T, P> const & m2)
|
||||
{
|
||||
return tmat3x2<T, P>(
|
||||
m1[0][0] * m2[0][0] + m1[1][0] * m2[0][1] + m1[2][0] * m2[0][2],
|
||||
@ -538,11 +465,7 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat4x2<T, P> operator*
|
||||
(
|
||||
tmat3x2<T, P> const & m1,
|
||||
tmat4x3<T, P> const & m2
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat4x2<T, P> operator*(tmat3x2<T, P> const & m1, tmat4x3<T, P> const & m2)
|
||||
{
|
||||
return tmat4x2<T, P>(
|
||||
m1[0][0] * m2[0][0] + m1[1][0] * m2[0][1] + m1[2][0] * m2[0][2],
|
||||
@ -556,11 +479,7 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat3x2<T, P> operator/
|
||||
(
|
||||
tmat3x2<T, P> const & m,
|
||||
T const & s
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat3x2<T, P> operator/(tmat3x2<T, P> const & m, T const & s)
|
||||
{
|
||||
return tmat3x2<T, P>(
|
||||
m[0] / s,
|
||||
@ -569,11 +488,7 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat3x2<T, P> operator/
|
||||
(
|
||||
T const & s,
|
||||
tmat3x2<T, P> const & m
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat3x2<T, P> operator/(T const & s, tmat3x2<T, P> const & m)
|
||||
{
|
||||
return tmat3x2<T, P>(
|
||||
s / m[0],
|
||||
@ -583,10 +498,7 @@ namespace detail
|
||||
|
||||
// Unary constant operators
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat3x2<T, P> const operator-
|
||||
(
|
||||
tmat3x2<T, P> const & m
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat3x2<T, P> const operator-(tmat3x2<T, P> const & m)
|
||||
{
|
||||
return tmat3x2<T, P>(
|
||||
-m[0],
|
||||
@ -598,24 +510,14 @@ namespace detail
|
||||
// Boolean operators
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER bool operator==
|
||||
(
|
||||
tmat3x2<T, P> const & m1,
|
||||
tmat3x2<T, P> const & m2
|
||||
)
|
||||
GLM_FUNC_QUALIFIER bool operator==(tmat3x2<T, P> const & m1, tmat3x2<T, P> const & m2)
|
||||
{
|
||||
return (m1[0] == m2[0]) && (m1[1] == m2[1]) && (m1[2] == m2[2]);
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER bool operator!=
|
||||
(
|
||||
tmat3x2<T, P> const & m1,
|
||||
tmat3x2<T, P> const & m2
|
||||
)
|
||||
GLM_FUNC_QUALIFIER bool operator!=(tmat3x2<T, P> const & m1, tmat3x2<T, P> const & m2)
|
||||
{
|
||||
return (m1[0] != m2[0]) || (m1[1] != m2[1]) || (m1[2] != m2[2]);
|
||||
}
|
||||
|
||||
} //namespace detail
|
||||
} //namespace glm
|
||||
|
||||
@ -12,6 +12,10 @@
|
||||
/// 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
|
||||
@ -21,34 +25,29 @@
|
||||
/// THE SOFTWARE.
|
||||
///
|
||||
/// @ref core
|
||||
/// @file glm/core/type_mat3x3.hpp
|
||||
/// @file glm/detail/type_mat3x3.hpp
|
||||
/// @date 2005-01-27 / 2011-06-15
|
||||
/// @author Christophe Riccio
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef glm_core_type_mat3x3
|
||||
#define glm_core_type_mat3x3
|
||||
#pragma once
|
||||
|
||||
#include "../fwd.hpp"
|
||||
#include "type_vec3.hpp"
|
||||
#include "type_mat.hpp"
|
||||
#include <limits>
|
||||
#include <cstddef>
|
||||
|
||||
namespace glm{
|
||||
namespace detail
|
||||
namespace glm
|
||||
{
|
||||
template <typename T, precision P>
|
||||
template <typename T, precision P = defaultp>
|
||||
struct tmat3x3
|
||||
{
|
||||
enum ctor{_null};
|
||||
typedef T value_type;
|
||||
typedef std::size_t size_type;
|
||||
typedef tvec3<T, P> col_type;
|
||||
typedef tvec3<T, P> row_type;
|
||||
typedef tmat3x3<T, P> type;
|
||||
typedef tmat3x3<T, P> transpose_type;
|
||||
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const;
|
||||
typedef T value_type;
|
||||
|
||||
template <typename U, precision Q>
|
||||
friend tvec3<U, Q> operator/(tmat3x3<U, Q> const & m, tvec3<U, Q> const & v);
|
||||
@ -59,18 +58,15 @@ namespace detail
|
||||
/// @cond DETAIL
|
||||
col_type value[3];
|
||||
/// @endcond
|
||||
|
||||
|
||||
public:
|
||||
// Constructors
|
||||
GLM_FUNC_DECL tmat3x3();
|
||||
GLM_FUNC_DECL tmat3x3(tmat3x3<T, P> const & m);
|
||||
template <precision Q>
|
||||
GLM_FUNC_DECL tmat3x3(tmat3x3<T, Q> const & m);
|
||||
|
||||
GLM_FUNC_DECL explicit tmat3x3(
|
||||
ctor Null);
|
||||
GLM_FUNC_DECL explicit tmat3x3(
|
||||
T const & s);
|
||||
GLM_FUNC_DECL explicit tmat3x3(ctor);
|
||||
GLM_FUNC_DECL explicit tmat3x3(T const & s);
|
||||
GLM_FUNC_DECL tmat3x3(
|
||||
T const & x0, T const & y0, T const & z0,
|
||||
T const & x1, T const & y1, T const & z1,
|
||||
@ -82,6 +78,7 @@ namespace detail
|
||||
|
||||
//////////////////////////////////////
|
||||
// Conversions
|
||||
|
||||
template<
|
||||
typename X1, typename Y1, typename Z1,
|
||||
typename X2, typename Y2, typename Z2,
|
||||
@ -97,9 +94,16 @@ namespace detail
|
||||
tvec3<V2, P> const & v2,
|
||||
tvec3<V3, P> const & v3);
|
||||
|
||||
//////////////////////////////////////
|
||||
// Matrix conversions
|
||||
template <typename U, precision Q>
|
||||
GLM_FUNC_DECL explicit tmat3x3(tmat3x3<U, Q> const & m);
|
||||
|
||||
# ifdef GLM_FORCE_EXPLICIT_CTOR
|
||||
template <typename U, precision Q>
|
||||
GLM_FUNC_DECL explicit tmat3x3(tmat3x3<U, Q> const & m);
|
||||
# else
|
||||
template <typename U, precision Q>
|
||||
GLM_FUNC_DECL tmat3x3(tmat3x3<U, Q> const & m);
|
||||
# endif
|
||||
|
||||
GLM_FUNC_DECL explicit tmat3x3(tmat2x2<T, P> const & x);
|
||||
GLM_FUNC_DECL explicit tmat3x3(tmat4x4<T, P> const & x);
|
||||
@ -110,12 +114,26 @@ namespace detail
|
||||
GLM_FUNC_DECL explicit tmat3x3(tmat3x4<T, P> const & x);
|
||||
GLM_FUNC_DECL explicit tmat3x3(tmat4x3<T, P> const & x);
|
||||
|
||||
//////////////////////////////////////
|
||||
// Accesses
|
||||
GLM_FUNC_DECL col_type & operator[](length_t i);
|
||||
GLM_FUNC_DECL col_type const & operator[](length_t i) const;
|
||||
|
||||
// Unary updatable operators
|
||||
GLM_FUNC_DECL tmat3x3<T, P>& operator= (tmat3x3<T, P> const & m);
|
||||
# ifdef GLM_FORCE_SIZE_FUNC
|
||||
typedef size_t size_type;
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR size_t size() const;
|
||||
|
||||
GLM_FUNC_DECL col_type & operator[](size_type i);
|
||||
GLM_FUNC_DECL col_type const & operator[](size_type i) const;
|
||||
# else
|
||||
typedef length_t length_type;
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR length_type length() const;
|
||||
|
||||
GLM_FUNC_DECL col_type & operator[](length_type i);
|
||||
GLM_FUNC_DECL col_type const & operator[](length_type i) const;
|
||||
# endif//GLM_FORCE_SIZE_FUNC
|
||||
|
||||
//////////////////////////////////////
|
||||
// Unary arithmetic operators
|
||||
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tmat3x3<T, P>& operator= (tmat3x3<U, P> const & m);
|
||||
template <typename U>
|
||||
@ -144,9 +162,6 @@ namespace detail
|
||||
GLM_FUNC_DECL tmat3x3<T, P> operator--(int);
|
||||
};
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tmat3x3<T, P> compute_inverse_mat3(tmat3x3<T, P> const & m);
|
||||
|
||||
// Binary operators
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tmat3x3<T, P> operator+ (
|
||||
@ -242,12 +257,8 @@ namespace detail
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tmat3x3<T, P> const operator-(
|
||||
tmat3x3<T, P> const & m);
|
||||
|
||||
}//namespace detail
|
||||
}//namespace glm
|
||||
|
||||
#ifndef GLM_EXTERNAL_TEMPLATE
|
||||
#include "type_mat3x3.inl"
|
||||
#endif
|
||||
|
||||
#endif //glm_core_type_mat3x3
|
||||
|
||||
@ -12,6 +12,10 @@
|
||||
/// 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
|
||||
@ -21,7 +25,7 @@
|
||||
/// THE SOFTWARE.
|
||||
///
|
||||
/// @ref core
|
||||
/// @file glm/core/type_mat3x3.inl
|
||||
/// @file glm/detail/type_mat3x3.inl
|
||||
/// @date 2005-01-27 / 2011-06-15
|
||||
/// @author Christophe Riccio
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
@ -30,35 +34,27 @@ namespace glm{
|
||||
namespace detail
|
||||
{
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR length_t tmat3x3<T, P>::length() const
|
||||
GLM_FUNC_QUALIFIER tmat3x3<T, P> compute_inverse(tmat3x3<T, P> const & m)
|
||||
{
|
||||
return 3;
|
||||
}
|
||||
T OneOverDeterminant = static_cast<T>(1) / (
|
||||
+ m[0][0] * (m[1][1] * m[2][2] - m[2][1] * m[1][2])
|
||||
- m[1][0] * (m[0][1] * m[2][2] - m[2][1] * m[0][2])
|
||||
+ m[2][0] * (m[0][1] * m[1][2] - m[1][1] * m[0][2]));
|
||||
|
||||
//////////////////////////////////////
|
||||
// Accesses
|
||||
tmat3x3<T, P> Inverse(uninitialize);
|
||||
Inverse[0][0] = + (m[1][1] * m[2][2] - m[2][1] * m[1][2]) * OneOverDeterminant;
|
||||
Inverse[1][0] = - (m[1][0] * m[2][2] - m[2][0] * m[1][2]) * OneOverDeterminant;
|
||||
Inverse[2][0] = + (m[1][0] * m[2][1] - m[2][0] * m[1][1]) * OneOverDeterminant;
|
||||
Inverse[0][1] = - (m[0][1] * m[2][2] - m[2][1] * m[0][2]) * OneOverDeterminant;
|
||||
Inverse[1][1] = + (m[0][0] * m[2][2] - m[2][0] * m[0][2]) * OneOverDeterminant;
|
||||
Inverse[2][1] = - (m[0][0] * m[2][1] - m[2][0] * m[0][1]) * OneOverDeterminant;
|
||||
Inverse[0][2] = + (m[0][1] * m[1][2] - m[1][1] * m[0][2]) * OneOverDeterminant;
|
||||
Inverse[1][2] = - (m[0][0] * m[1][2] - m[1][0] * m[0][2]) * OneOverDeterminant;
|
||||
Inverse[2][2] = + (m[0][0] * m[1][1] - m[1][0] * m[0][1]) * OneOverDeterminant;
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER typename tmat3x3<T, P>::col_type &
|
||||
tmat3x3<T, P>::operator[]
|
||||
(
|
||||
length_t i
|
||||
)
|
||||
{
|
||||
assert(i < this->length());
|
||||
return this->value[i];
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER typename tmat3x3<T, P>::col_type const &
|
||||
tmat3x3<T, P>::operator[]
|
||||
(
|
||||
length_t i
|
||||
) const
|
||||
{
|
||||
assert(i < this->length());
|
||||
return this->value[i];
|
||||
return Inverse;
|
||||
}
|
||||
}//namespace detail
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
// Constructors
|
||||
@ -66,35 +62,20 @@ namespace detail
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat3x3<T, P>::tmat3x3()
|
||||
{
|
||||
value_type const Zero(0);
|
||||
value_type const One(1);
|
||||
this->value[0] = col_type(One, Zero, Zero);
|
||||
this->value[1] = col_type(Zero, One, Zero);
|
||||
this->value[2] = col_type(Zero, Zero, One);
|
||||
# ifndef GLM_FORCE_NO_CTOR_INIT
|
||||
this->value[0] = col_type(1, 0, 0);
|
||||
this->value[1] = col_type(0, 1, 0);
|
||||
this->value[2] = col_type(0, 0, 1);
|
||||
# endif
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat3x3<T, P>::tmat3x3
|
||||
(
|
||||
tmat3x3<T, P> const & m
|
||||
)
|
||||
{
|
||||
this->value[0] = m.value[0];
|
||||
this->value[1] = m.value[1];
|
||||
this->value[2] = m.value[2];
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat3x3<T, P>::tmat3x3
|
||||
(
|
||||
ctor
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat3x3<T, P>::tmat3x3(ctor)
|
||||
{}
|
||||
|
||||
template <typename T, precision P>
|
||||
template <precision Q>
|
||||
GLM_FUNC_QUALIFIER tmat3x3<T, P>::tmat3x3(
|
||||
tmat3x3<T, Q> const & m)
|
||||
GLM_FUNC_QUALIFIER tmat3x3<T, P>::tmat3x3(tmat3x3<T, Q> const & m)
|
||||
{
|
||||
this->value[0] = m.value[0];
|
||||
this->value[1] = m.value[1];
|
||||
@ -102,15 +83,11 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat3x3<T, P>::tmat3x3
|
||||
(
|
||||
T const & s
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat3x3<T, P>::tmat3x3(T const & s)
|
||||
{
|
||||
value_type const Zero(0);
|
||||
this->value[0] = col_type(s, Zero, Zero);
|
||||
this->value[1] = col_type(Zero, s, Zero);
|
||||
this->value[2] = col_type(Zero, Zero, s);
|
||||
this->value[0] = col_type(s, 0, 0);
|
||||
this->value[1] = col_type(0, s, 0);
|
||||
this->value[2] = col_type(0, 0, s);
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
@ -177,10 +154,7 @@ namespace detail
|
||||
|
||||
template <typename T, precision P>
|
||||
template <typename U, precision Q>
|
||||
GLM_FUNC_QUALIFIER tmat3x3<T, P>::tmat3x3
|
||||
(
|
||||
tmat3x3<U, Q> const & m
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat3x3<T, P>::tmat3x3(tmat3x3<U, Q> const & m)
|
||||
{
|
||||
this->value[0] = col_type(m[0]);
|
||||
this->value[1] = col_type(m[1]);
|
||||
@ -188,21 +162,15 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat3x3<T, P>::tmat3x3
|
||||
(
|
||||
tmat2x2<T, P> const & m
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat3x3<T, P>::tmat3x3(tmat2x2<T, P> const & m)
|
||||
{
|
||||
this->value[0] = col_type(m[0], value_type(0));
|
||||
this->value[1] = col_type(m[1], value_type(0));
|
||||
this->value[2] = col_type(detail::tvec2<T, P>(0), value_type(1));
|
||||
this->value[0] = col_type(m[0], 0);
|
||||
this->value[1] = col_type(m[1], 0);
|
||||
this->value[2] = col_type(0, 0, 1);
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat3x3<T, P>::tmat3x3
|
||||
(
|
||||
tmat4x4<T, P> const & m
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat3x3<T, P>::tmat3x3(tmat4x4<T, P> const & m)
|
||||
{
|
||||
this->value[0] = col_type(m[0]);
|
||||
this->value[1] = col_type(m[1]);
|
||||
@ -210,54 +178,39 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat3x3<T, P>::tmat3x3
|
||||
(
|
||||
tmat2x3<T, P> const & m
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat3x3<T, P>::tmat3x3(tmat2x3<T, P> const & m)
|
||||
{
|
||||
this->value[0] = m[0];
|
||||
this->value[1] = m[1];
|
||||
this->value[2] = col_type(detail::tvec2<T, P>(0), value_type(1));
|
||||
this->value[2] = col_type(0, 0, 1);
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat3x3<T, P>::tmat3x3
|
||||
(
|
||||
tmat3x2<T, P> const & m
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat3x3<T, P>::tmat3x3(tmat3x2<T, P> const & m)
|
||||
{
|
||||
this->value[0] = col_type(m[0], value_type(0));
|
||||
this->value[1] = col_type(m[1], value_type(0));
|
||||
this->value[2] = col_type(m[2], value_type(1));
|
||||
this->value[0] = col_type(m[0], 0);
|
||||
this->value[1] = col_type(m[1], 0);
|
||||
this->value[2] = col_type(m[2], 1);
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat3x3<T, P>::tmat3x3
|
||||
(
|
||||
tmat2x4<T, P> const & m
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat3x3<T, P>::tmat3x3(tmat2x4<T, P> const & m)
|
||||
{
|
||||
this->value[0] = col_type(m[0]);
|
||||
this->value[1] = col_type(m[1]);
|
||||
this->value[2] = col_type(detail::tvec2<T, P>(0), value_type(1));
|
||||
this->value[2] = col_type(0, 0, 1);
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat3x3<T, P>::tmat3x3
|
||||
(
|
||||
tmat4x2<T, P> const & m
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat3x3<T, P>::tmat3x3(tmat4x2<T, P> const & m)
|
||||
{
|
||||
this->value[0] = col_type(m[0], value_type(0));
|
||||
this->value[1] = col_type(m[1], value_type(0));
|
||||
this->value[2] = col_type(m[2], value_type(1));
|
||||
this->value[0] = col_type(m[0], 0);
|
||||
this->value[1] = col_type(m[1], 0);
|
||||
this->value[2] = col_type(m[2], 1);
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat3x3<T, P>::tmat3x3
|
||||
(
|
||||
tmat3x4<T, P> const & m
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat3x3<T, P>::tmat3x3(tmat3x4<T, P> const & m)
|
||||
{
|
||||
this->value[0] = col_type(m[0]);
|
||||
this->value[1] = col_type(m[1]);
|
||||
@ -265,21 +218,64 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat3x3<T, P>::tmat3x3
|
||||
(
|
||||
tmat4x3<T, P> const & m
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat3x3<T, P>::tmat3x3(tmat4x3<T, P> const & m)
|
||||
{
|
||||
this->value[0] = m[0];
|
||||
this->value[1] = m[1];
|
||||
this->value[2] = m[2];
|
||||
}
|
||||
|
||||
//////////////////////////////////////
|
||||
// Accesses
|
||||
|
||||
# ifdef GLM_FORCE_SIZE_FUNC
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tmat3x3<T, P>::size_type tmat3x3<T, P>::size() const
|
||||
{
|
||||
return 3;
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER typename tmat3x3<T, P>::col_type & tmat3x3<T, P>::operator[](typename tmat3x3<T, P>::size_type i)
|
||||
{
|
||||
assert(i < this->size());
|
||||
return this->value[i];
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER typename tmat3x3<T, P>::col_type const & tmat3x3<T, P>::operator[](typename tmat3x3<T, P>::size_type i) const
|
||||
{
|
||||
assert(i < this->size());
|
||||
return this->value[i];
|
||||
}
|
||||
# else
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tmat3x3<T, P>::length_type tmat3x3<T, P>::length() const
|
||||
{
|
||||
return 3;
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER typename tmat3x3<T, P>::col_type & tmat3x3<T, P>::operator[](typename tmat3x3<T, P>::length_type i)
|
||||
{
|
||||
assert(i < this->length());
|
||||
return this->value[i];
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER typename tmat3x3<T, P>::col_type const & tmat3x3<T, P>::operator[](typename tmat3x3<T, P>::length_type i) const
|
||||
{
|
||||
assert(i < this->length());
|
||||
return this->value[i];
|
||||
}
|
||||
# endif//GLM_FORCE_SIZE_FUNC
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
// Operators
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat3x3<T, P> & tmat3x3<T, P>::operator= (tmat3x3<T, P> const & m)
|
||||
template <typename T, precision P>
|
||||
template <typename U>
|
||||
GLM_FUNC_QUALIFIER tmat3x3<T, P> & tmat3x3<T, P>::operator=(tmat3x3<U, P> const & m)
|
||||
{
|
||||
this->value[0] = m[0];
|
||||
this->value[1] = m[1];
|
||||
@ -289,17 +285,7 @@ namespace detail
|
||||
|
||||
template <typename T, precision P>
|
||||
template <typename U>
|
||||
GLM_FUNC_QUALIFIER tmat3x3<T, P> & tmat3x3<T, P>::operator= (tmat3x3<U, P> const & m)
|
||||
{
|
||||
this->value[0] = m[0];
|
||||
this->value[1] = m[1];
|
||||
this->value[2] = m[2];
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
template <typename U>
|
||||
GLM_FUNC_QUALIFIER tmat3x3<T, P> & tmat3x3<T, P>::operator+= (U s)
|
||||
GLM_FUNC_QUALIFIER tmat3x3<T, P> & tmat3x3<T, P>::operator+=(U s)
|
||||
{
|
||||
this->value[0] += s;
|
||||
this->value[1] += s;
|
||||
@ -309,7 +295,7 @@ namespace detail
|
||||
|
||||
template <typename T, precision P>
|
||||
template <typename U>
|
||||
GLM_FUNC_QUALIFIER tmat3x3<T, P> & tmat3x3<T, P>::operator+= (tmat3x3<U, P> const & m)
|
||||
GLM_FUNC_QUALIFIER tmat3x3<T, P> & tmat3x3<T, P>::operator+=(tmat3x3<U, P> const & m)
|
||||
{
|
||||
this->value[0] += m[0];
|
||||
this->value[1] += m[1];
|
||||
@ -319,7 +305,7 @@ namespace detail
|
||||
|
||||
template <typename T, precision P>
|
||||
template <typename U>
|
||||
GLM_FUNC_QUALIFIER tmat3x3<T, P> & tmat3x3<T, P>::operator-= (U s)
|
||||
GLM_FUNC_QUALIFIER tmat3x3<T, P> & tmat3x3<T, P>::operator-=(U s)
|
||||
{
|
||||
this->value[0] -= s;
|
||||
this->value[1] -= s;
|
||||
@ -329,7 +315,7 @@ namespace detail
|
||||
|
||||
template <typename T, precision P>
|
||||
template <typename U>
|
||||
GLM_FUNC_QUALIFIER tmat3x3<T, P> & tmat3x3<T, P>::operator-= (tmat3x3<U, P> const & m)
|
||||
GLM_FUNC_QUALIFIER tmat3x3<T, P> & tmat3x3<T, P>::operator-=(tmat3x3<U, P> const & m)
|
||||
{
|
||||
this->value[0] -= m[0];
|
||||
this->value[1] -= m[1];
|
||||
@ -339,7 +325,7 @@ namespace detail
|
||||
|
||||
template <typename T, precision P>
|
||||
template <typename U>
|
||||
GLM_FUNC_QUALIFIER tmat3x3<T, P> & tmat3x3<T, P>::operator*= (U s)
|
||||
GLM_FUNC_QUALIFIER tmat3x3<T, P> & tmat3x3<T, P>::operator*=(U s)
|
||||
{
|
||||
this->value[0] *= s;
|
||||
this->value[1] *= s;
|
||||
@ -349,14 +335,14 @@ namespace detail
|
||||
|
||||
template <typename T, precision P>
|
||||
template <typename U>
|
||||
GLM_FUNC_QUALIFIER tmat3x3<T, P> & tmat3x3<T, P>::operator*= (tmat3x3<U, P> const & m)
|
||||
GLM_FUNC_QUALIFIER tmat3x3<T, P> & tmat3x3<T, P>::operator*=(tmat3x3<U, P> const & m)
|
||||
{
|
||||
return (*this = *this * m);
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
template <typename U>
|
||||
GLM_FUNC_QUALIFIER tmat3x3<T, P> & tmat3x3<T, P>::operator/= (U s)
|
||||
GLM_FUNC_QUALIFIER tmat3x3<T, P> & tmat3x3<T, P>::operator/=(U s)
|
||||
{
|
||||
this->value[0] /= s;
|
||||
this->value[1] /= s;
|
||||
@ -366,13 +352,13 @@ namespace detail
|
||||
|
||||
template <typename T, precision P>
|
||||
template <typename U>
|
||||
GLM_FUNC_QUALIFIER tmat3x3<T, P> & tmat3x3<T, P>::operator/= (tmat3x3<U, P> const & m)
|
||||
GLM_FUNC_QUALIFIER tmat3x3<T, P> & tmat3x3<T, P>::operator/=(tmat3x3<U, P> const & m)
|
||||
{
|
||||
return (*this = *this * detail::compute_inverse<detail::tmat3x3, T, P>::call(m));
|
||||
return (*this = *this * detail::compute_inverse<T, P>(m));
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat3x3<T, P> & tmat3x3<T, P>::operator++ ()
|
||||
GLM_FUNC_QUALIFIER tmat3x3<T, P> & tmat3x3<T, P>::operator++()
|
||||
{
|
||||
++this->value[0];
|
||||
++this->value[1];
|
||||
@ -405,86 +391,11 @@ namespace detail
|
||||
return Result;
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
struct compute_inverse<detail::tmat3x3, T, P>
|
||||
{
|
||||
static detail::tmat3x3<T, P> call(detail::tmat3x3<T, P> const & m)
|
||||
{
|
||||
T OneOverDeterminant = static_cast<T>(1) / (
|
||||
+ m[0][0] * (m[1][1] * m[2][2] - m[2][1] * m[1][2])
|
||||
- m[1][0] * (m[0][1] * m[2][2] - m[2][1] * m[0][2])
|
||||
+ m[2][0] * (m[0][1] * m[1][2] - m[1][1] * m[0][2]));
|
||||
|
||||
detail::tmat3x3<T, P> Inverse(detail::tmat3x3<T, P>::_null);
|
||||
Inverse[0][0] = + (m[1][1] * m[2][2] - m[2][1] * m[1][2]) * OneOverDeterminant;
|
||||
Inverse[1][0] = - (m[1][0] * m[2][2] - m[2][0] * m[1][2]) * OneOverDeterminant;
|
||||
Inverse[2][0] = + (m[1][0] * m[2][1] - m[2][0] * m[1][1]) * OneOverDeterminant;
|
||||
Inverse[0][1] = - (m[0][1] * m[2][2] - m[2][1] * m[0][2]) * OneOverDeterminant;
|
||||
Inverse[1][1] = + (m[0][0] * m[2][2] - m[2][0] * m[0][2]) * OneOverDeterminant;
|
||||
Inverse[2][1] = - (m[0][0] * m[2][1] - m[2][0] * m[0][1]) * OneOverDeterminant;
|
||||
Inverse[0][2] = + (m[0][1] * m[1][2] - m[1][1] * m[0][2]) * OneOverDeterminant;
|
||||
Inverse[1][2] = - (m[0][0] * m[1][2] - m[1][0] * m[0][2]) * OneOverDeterminant;
|
||||
Inverse[2][2] = + (m[0][0] * m[1][1] - m[1][0] * m[0][1]) * OneOverDeterminant;
|
||||
|
||||
return Inverse;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat3x3<T, P> compute_inverse_mat3(tmat3x3<T, P> const & m)
|
||||
{
|
||||
T S00 = m[0][0];
|
||||
T S01 = m[0][1];
|
||||
T S02 = m[0][2];
|
||||
|
||||
T S10 = m[1][0];
|
||||
T S11 = m[1][1];
|
||||
T S12 = m[1][2];
|
||||
|
||||
T S20 = m[2][0];
|
||||
T S21 = m[2][1];
|
||||
T S22 = m[2][2];
|
||||
/*
|
||||
tmat3x3<T, P> Inverse(
|
||||
+ (S11 * S22 - S21 * S12),
|
||||
- (S10 * S22 - S20 * S12),
|
||||
+ (S10 * S21 - S20 * S11),
|
||||
- (S01 * S22 - S21 * S02),
|
||||
+ (S00 * S22 - S20 * S02),
|
||||
- (S00 * S21 - S20 * S01),
|
||||
+ (S01 * S12 - S11 * S02),
|
||||
- (S00 * S12 - S10 * S02),
|
||||
+ (S00 * S11 - S10 * S01));
|
||||
*/
|
||||
tmat3x3<T, P> Inverse(
|
||||
S11 * S22 - S21 * S12,
|
||||
S12 * S20 - S22 * S10,
|
||||
S10 * S21 - S20 * S11,
|
||||
S02 * S21 - S01 * S22,
|
||||
S00 * S22 - S02 * S20,
|
||||
S01 * S20 - S00 * S21,
|
||||
S12 * S01 - S11 * S02,
|
||||
S10 * S02 - S12 * S00,
|
||||
S11 * S00 - S10 * S01);
|
||||
|
||||
T Determinant =
|
||||
+ S00 * (S11 * S22 - S21 * S12)
|
||||
- S10 * (S01 * S22 - S21 * S02)
|
||||
+ S20 * (S01 * S12 - S11 * S02);
|
||||
|
||||
Inverse /= Determinant;
|
||||
return Inverse;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
// Binary operators
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat3x3<T, P> operator+
|
||||
(
|
||||
tmat3x3<T, P> const & m,
|
||||
T const & s
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat3x3<T, P> operator+(tmat3x3<T, P> const & m, T const & s)
|
||||
{
|
||||
return tmat3x3<T, P>(
|
||||
m[0] + s,
|
||||
@ -493,11 +404,7 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat3x3<T, P> operator+
|
||||
(
|
||||
T const & s,
|
||||
tmat3x3<T, P> const & m
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat3x3<T, P> operator+(T const & s, tmat3x3<T, P> const & m)
|
||||
{
|
||||
return tmat3x3<T, P>(
|
||||
m[0] + s,
|
||||
@ -506,11 +413,7 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat3x3<T, P> operator+
|
||||
(
|
||||
tmat3x3<T, P> const & m1,
|
||||
tmat3x3<T, P> const & m2
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat3x3<T, P> operator+(tmat3x3<T, P> const & m1, tmat3x3<T, P> const & m2)
|
||||
{
|
||||
return tmat3x3<T, P>(
|
||||
m1[0] + m2[0],
|
||||
@ -519,11 +422,7 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat3x3<T, P> operator-
|
||||
(
|
||||
tmat3x3<T, P> const & m,
|
||||
T const & s
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat3x3<T, P> operator-(tmat3x3<T, P> const & m, T const & s)
|
||||
{
|
||||
return tmat3x3<T, P>(
|
||||
m[0] - s,
|
||||
@ -532,11 +431,7 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat3x3<T, P> operator-
|
||||
(
|
||||
T const & s,
|
||||
tmat3x3<T, P> const & m
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat3x3<T, P> operator-(T const & s, tmat3x3<T, P> const & m)
|
||||
{
|
||||
return tmat3x3<T, P>(
|
||||
s - m[0],
|
||||
@ -545,11 +440,7 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat3x3<T, P> operator-
|
||||
(
|
||||
tmat3x3<T, P> const & m1,
|
||||
tmat3x3<T, P> const & m2
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat3x3<T, P> operator-(tmat3x3<T, P> const & m1, tmat3x3<T, P> const & m2)
|
||||
{
|
||||
return tmat3x3<T, P>(
|
||||
m1[0] - m2[0],
|
||||
@ -558,11 +449,7 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat3x3<T, P> operator*
|
||||
(
|
||||
tmat3x3<T, P> const & m,
|
||||
T const & s
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat3x3<T, P> operator*(tmat3x3<T, P> const & m, T const & s)
|
||||
{
|
||||
return tmat3x3<T, P>(
|
||||
m[0] * s,
|
||||
@ -571,11 +458,7 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat3x3<T, P> operator*
|
||||
(
|
||||
T const & s,
|
||||
tmat3x3<T, P> const & m
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat3x3<T, P> operator*(T const & s, tmat3x3<T, P> const & m)
|
||||
{
|
||||
return tmat3x3<T, P>(
|
||||
m[0] * s,
|
||||
@ -584,11 +467,7 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER typename tmat3x3<T, P>::col_type operator*
|
||||
(
|
||||
tmat3x3<T, P> const & m,
|
||||
typename tmat3x3<T, P>::row_type const & v
|
||||
)
|
||||
GLM_FUNC_QUALIFIER typename tmat3x3<T, P>::col_type operator*(tmat3x3<T, P> const & m, typename tmat3x3<T, P>::row_type const & v)
|
||||
{
|
||||
return typename tmat3x3<T, P>::col_type(
|
||||
m[0][0] * v.x + m[1][0] * v.y + m[2][0] * v.z,
|
||||
@ -597,11 +476,7 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER typename tmat3x3<T, P>::row_type operator*
|
||||
(
|
||||
typename tmat3x3<T, P>::col_type const & v,
|
||||
tmat3x3<T, P> const & m
|
||||
)
|
||||
GLM_FUNC_QUALIFIER typename tmat3x3<T, P>::row_type operator*(typename tmat3x3<T, P>::col_type const & v, tmat3x3<T, P> const & m)
|
||||
{
|
||||
return typename tmat3x3<T, P>::row_type(
|
||||
m[0][0] * v.x + m[0][1] * v.y + m[0][2] * v.z,
|
||||
@ -610,11 +485,7 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat3x3<T, P> operator*
|
||||
(
|
||||
tmat3x3<T, P> const & m1,
|
||||
tmat3x3<T, P> const & m2
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat3x3<T, P> operator*(tmat3x3<T, P> const & m1, tmat3x3<T, P> const & m2)
|
||||
{
|
||||
T const SrcA00 = m1[0][0];
|
||||
T const SrcA01 = m1[0][1];
|
||||
@ -636,7 +507,7 @@ namespace detail
|
||||
T const SrcB21 = m2[2][1];
|
||||
T const SrcB22 = m2[2][2];
|
||||
|
||||
tmat3x3<T, P> Result(tmat3x3<T, P>::_null);
|
||||
tmat3x3<T, P> Result(uninitialize);
|
||||
Result[0][0] = SrcA00 * SrcB00 + SrcA10 * SrcB01 + SrcA20 * SrcB02;
|
||||
Result[0][1] = SrcA01 * SrcB00 + SrcA11 * SrcB01 + SrcA21 * SrcB02;
|
||||
Result[0][2] = SrcA02 * SrcB00 + SrcA12 * SrcB01 + SrcA22 * SrcB02;
|
||||
@ -650,11 +521,7 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat2x3<T, P> operator*
|
||||
(
|
||||
tmat3x3<T, P> const & m1,
|
||||
tmat2x3<T, P> const & m2
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat2x3<T, P> operator*(tmat3x3<T, P> const & m1, tmat2x3<T, P> const & m2)
|
||||
{
|
||||
return tmat2x3<T, P>(
|
||||
m1[0][0] * m2[0][0] + m1[1][0] * m2[0][1] + m1[2][0] * m2[0][2],
|
||||
@ -666,11 +533,7 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat4x3<T, P> operator*
|
||||
(
|
||||
tmat3x3<T, P> const & m1,
|
||||
tmat4x3<T, P> const & m2
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat4x3<T, P> operator*(tmat3x3<T, P> const & m1, tmat4x3<T, P> const & m2)
|
||||
{
|
||||
return tmat4x3<T, P>(
|
||||
m1[0][0] * m2[0][0] + m1[1][0] * m2[0][1] + m1[2][0] * m2[0][2],
|
||||
@ -688,11 +551,7 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat3x3<T, P> operator/
|
||||
(
|
||||
tmat3x3<T, P> const & m,
|
||||
T const & s
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat3x3<T, P> operator/(tmat3x3<T, P> const & m, T const & s)
|
||||
{
|
||||
return tmat3x3<T, P>(
|
||||
m[0] / s,
|
||||
@ -701,11 +560,7 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat3x3<T, P> operator/
|
||||
(
|
||||
T const & s,
|
||||
tmat3x3<T, P> const & m
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat3x3<T, P> operator/(T const & s, tmat3x3<T, P> const & m)
|
||||
{
|
||||
return tmat3x3<T, P>(
|
||||
s / m[0],
|
||||
@ -714,31 +569,19 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER typename tmat3x3<T, P>::col_type operator/
|
||||
(
|
||||
tmat3x3<T, P> const & m,
|
||||
typename tmat3x3<T, P>::row_type const & v
|
||||
)
|
||||
GLM_FUNC_QUALIFIER typename tmat3x3<T, P>::col_type operator/(tmat3x3<T, P> const & m, typename tmat3x3<T, P>::row_type const & v)
|
||||
{
|
||||
return detail::compute_inverse<detail::tmat3x3, T, P>::call(m) * v;
|
||||
return detail::compute_inverse<T, P>(m) * v;
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER typename tmat3x3<T, P>::row_type operator/
|
||||
(
|
||||
typename tmat3x3<T, P>::col_type const & v,
|
||||
tmat3x3<T, P> const & m
|
||||
)
|
||||
GLM_FUNC_QUALIFIER typename tmat3x3<T, P>::row_type operator/(typename tmat3x3<T, P>::col_type const & v, tmat3x3<T, P> const & m)
|
||||
{
|
||||
return v * detail::compute_inverse<detail::tmat3x3, T, P>::call(m);
|
||||
return v * detail::compute_inverse<T, P>(m);
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat3x3<T, P> operator/
|
||||
(
|
||||
tmat3x3<T, P> const & m1,
|
||||
tmat3x3<T, P> const & m2
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat3x3<T, P> operator/(tmat3x3<T, P> const & m1, tmat3x3<T, P> const & m2)
|
||||
{
|
||||
tmat3x3<T, P> m1_copy(m1);
|
||||
return m1_copy /= m2;
|
||||
@ -746,10 +589,7 @@ namespace detail
|
||||
|
||||
// Unary constant operators
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat3x3<T, P> const operator-
|
||||
(
|
||||
tmat3x3<T, P> const & m
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat3x3<T, P> const operator-(tmat3x3<T, P> const & m)
|
||||
{
|
||||
return tmat3x3<T, P>(
|
||||
-m[0],
|
||||
@ -761,24 +601,14 @@ namespace detail
|
||||
// Boolean operators
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER bool operator==
|
||||
(
|
||||
tmat3x3<T, P> const & m1,
|
||||
tmat3x3<T, P> const & m2
|
||||
)
|
||||
GLM_FUNC_QUALIFIER bool operator==(tmat3x3<T, P> const & m1, tmat3x3<T, P> const & m2)
|
||||
{
|
||||
return (m1[0] == m2[0]) && (m1[1] == m2[1]) && (m1[2] == m2[2]);
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER bool operator!=
|
||||
(
|
||||
tmat3x3<T, P> const & m1,
|
||||
tmat3x3<T, P> const & m2
|
||||
)
|
||||
GLM_FUNC_QUALIFIER bool operator!=(tmat3x3<T, P> const & m1, tmat3x3<T, P> const & m2)
|
||||
{
|
||||
return (m1[0] != m2[0]) || (m1[1] != m2[1]) || (m1[2] != m2[2]);
|
||||
}
|
||||
|
||||
} //namespace detail
|
||||
} //namespace glm
|
||||
|
||||
@ -12,6 +12,10 @@
|
||||
/// 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
|
||||
@ -21,51 +25,44 @@
|
||||
/// THE SOFTWARE.
|
||||
///
|
||||
/// @ref core
|
||||
/// @file glm/core/type_mat3x4.hpp
|
||||
/// @file glm/detail/type_mat3x4.hpp
|
||||
/// @date 2006-08-05 / 2011-06-15
|
||||
/// @author Christophe Riccio
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef glm_core_type_mat3x4
|
||||
#define glm_core_type_mat3x4
|
||||
#pragma once
|
||||
|
||||
#include "../fwd.hpp"
|
||||
#include "type_vec3.hpp"
|
||||
#include "type_vec4.hpp"
|
||||
#include "type_mat.hpp"
|
||||
#include <limits>
|
||||
#include <cstddef>
|
||||
|
||||
namespace glm{
|
||||
namespace detail
|
||||
namespace glm
|
||||
{
|
||||
template <typename T, precision P>
|
||||
template <typename T, precision P = defaultp>
|
||||
struct tmat3x4
|
||||
{
|
||||
enum ctor{_null};
|
||||
typedef T value_type;
|
||||
typedef std::size_t size_type;
|
||||
typedef tvec4<T, P> col_type;
|
||||
typedef tvec3<T, P> row_type;
|
||||
typedef tmat3x4<T, P> type;
|
||||
typedef tmat4x3<T, P> transpose_type;
|
||||
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const;
|
||||
typedef T value_type;
|
||||
|
||||
private:
|
||||
// Data
|
||||
/// @cond DETAIL
|
||||
col_type value[3];
|
||||
/// @endcond
|
||||
|
||||
public:
|
||||
// Constructors
|
||||
GLM_FUNC_DECL tmat3x4();
|
||||
GLM_FUNC_DECL tmat3x4(tmat3x4<T, P> const & m);
|
||||
template <precision Q>
|
||||
GLM_FUNC_DECL tmat3x4(tmat3x4<T, Q> const & m);
|
||||
|
||||
GLM_FUNC_DECL explicit tmat3x4(
|
||||
ctor Null);
|
||||
GLM_FUNC_DECL explicit tmat3x4(
|
||||
T const & s);
|
||||
GLM_FUNC_DECL explicit tmat3x4(ctor);
|
||||
GLM_FUNC_DECL explicit tmat3x4(T const & s);
|
||||
GLM_FUNC_DECL tmat3x4(
|
||||
T const & x0, T const & y0, T const & z0, T const & w0,
|
||||
T const & x1, T const & y1, T const & z1, T const & w1,
|
||||
@ -92,9 +89,16 @@ namespace detail
|
||||
tvec4<V2, P> const & v2,
|
||||
tvec4<V3, P> const & v3);
|
||||
|
||||
//////////////////////////////////////
|
||||
// Matrix conversion
|
||||
template <typename U, precision Q>
|
||||
GLM_FUNC_DECL explicit tmat3x4(tmat3x4<U, Q> const & m);
|
||||
|
||||
# ifdef GLM_FORCE_EXPLICIT_CTOR
|
||||
template <typename U, precision Q>
|
||||
GLM_FUNC_DECL explicit tmat3x4(tmat3x4<U, Q> const & m);
|
||||
# else
|
||||
template <typename U, precision Q>
|
||||
GLM_FUNC_DECL tmat3x4(tmat3x4<U, Q> const & m);
|
||||
# endif
|
||||
|
||||
GLM_FUNC_DECL explicit tmat3x4(tmat2x2<T, P> const & x);
|
||||
GLM_FUNC_DECL explicit tmat3x4(tmat3x3<T, P> const & x);
|
||||
@ -105,112 +109,95 @@ namespace detail
|
||||
GLM_FUNC_DECL explicit tmat3x4(tmat4x2<T, P> const & x);
|
||||
GLM_FUNC_DECL explicit tmat3x4(tmat4x3<T, P> const & x);
|
||||
|
||||
//////////////////////////////////////
|
||||
// Accesses
|
||||
GLM_FUNC_DECL col_type & operator[](length_t i);
|
||||
GLM_FUNC_DECL col_type const & operator[](length_t i) const;
|
||||
|
||||
// Unary updatable operators
|
||||
GLM_FUNC_DECL tmat3x4<T, P> & operator= (tmat3x4<T, P> const & m);
|
||||
# ifdef GLM_FORCE_SIZE_FUNC
|
||||
typedef size_t size_type;
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR size_t size() const;
|
||||
|
||||
GLM_FUNC_DECL col_type & operator[](size_type i);
|
||||
GLM_FUNC_DECL col_type const & operator[](size_type i) const;
|
||||
# else
|
||||
typedef length_t length_type;
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR length_type length() const;
|
||||
|
||||
GLM_FUNC_DECL col_type & operator[](length_type i);
|
||||
GLM_FUNC_DECL col_type const & operator[](length_type i) const;
|
||||
# endif//GLM_FORCE_SIZE_FUNC
|
||||
|
||||
//////////////////////////////////////
|
||||
// Unary arithmetic operators
|
||||
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tmat3x4<T, P> & operator= (tmat3x4<U, P> const & m);
|
||||
GLM_FUNC_DECL tmat3x4<T, P> & operator=(tmat3x4<U, P> const & m);
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tmat3x4<T, P> & operator+= (U s);
|
||||
GLM_FUNC_DECL tmat3x4<T, P> & operator+=(U s);
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tmat3x4<T, P> & operator+= (tmat3x4<U, P> const & m);
|
||||
GLM_FUNC_DECL tmat3x4<T, P> & operator+=(tmat3x4<U, P> const & m);
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tmat3x4<T, P> & operator-= (U s);
|
||||
GLM_FUNC_DECL tmat3x4<T, P> & operator-=(U s);
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tmat3x4<T, P> & operator-= (tmat3x4<U, P> const & m);
|
||||
GLM_FUNC_DECL tmat3x4<T, P> & operator-=(tmat3x4<U, P> const & m);
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tmat3x4<T, P> & operator*= (U s);
|
||||
GLM_FUNC_DECL tmat3x4<T, P> & operator*=(U s);
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tmat3x4<T, P> & operator/= (U s);
|
||||
GLM_FUNC_DECL tmat3x4<T, P> & operator/=(U s);
|
||||
|
||||
//////////////////////////////////////
|
||||
// Increment and decrement operators
|
||||
|
||||
GLM_FUNC_DECL tmat3x4<T, P> & operator++ ();
|
||||
GLM_FUNC_DECL tmat3x4<T, P> & operator-- ();
|
||||
GLM_FUNC_DECL tmat3x4<T, P> & operator++();
|
||||
GLM_FUNC_DECL tmat3x4<T, P> & operator--();
|
||||
GLM_FUNC_DECL tmat3x4<T, P> operator++(int);
|
||||
GLM_FUNC_DECL tmat3x4<T, P> operator--(int);
|
||||
};
|
||||
|
||||
// Binary operators
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tmat3x4<T, P> operator+ (
|
||||
tmat3x4<T, P> const & m,
|
||||
T const & s);
|
||||
GLM_FUNC_DECL tmat3x4<T, P> operator+(tmat3x4<T, P> const & m, T const & s);
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tmat3x4<T, P> operator+ (
|
||||
tmat3x4<T, P> const & m1,
|
||||
tmat3x4<T, P> const & m2);
|
||||
GLM_FUNC_DECL tmat3x4<T, P> operator+(tmat3x4<T, P> const & m1, tmat3x4<T, P> const & m2);
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tmat3x4<T, P> operator- (
|
||||
tmat3x4<T, P> const & m,
|
||||
T const & s);
|
||||
GLM_FUNC_DECL tmat3x4<T, P> operator-(tmat3x4<T, P> const & m, T const & s);
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tmat3x4<T, P> operator- (
|
||||
tmat3x4<T, P> const & m1,
|
||||
tmat3x4<T, P> const & m2);
|
||||
GLM_FUNC_DECL tmat3x4<T, P> operator-(tmat3x4<T, P> const & m1, tmat3x4<T, P> const & m2);
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tmat3x4<T, P> operator* (
|
||||
tmat3x4<T, P> const & m,
|
||||
T const & s);
|
||||
GLM_FUNC_DECL tmat3x4<T, P> operator*(tmat3x4<T, P> const & m, T const & s);
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tmat3x4<T, P> operator* (
|
||||
T const & s,
|
||||
tmat3x4<T, P> const & m);
|
||||
GLM_FUNC_DECL tmat3x4<T, P> operator*(T const & s, tmat3x4<T, P> const & m);
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL typename tmat3x4<T, P>::col_type operator* (
|
||||
tmat3x4<T, P> const & m,
|
||||
typename tmat3x4<T, P>::row_type const & v);
|
||||
GLM_FUNC_DECL typename tmat3x4<T, P>::col_type operator*(tmat3x4<T, P> const & m, typename tmat3x4<T, P>::row_type const & v);
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL typename tmat3x4<T, P>::row_type operator* (
|
||||
typename tmat3x4<T, P>::col_type const & v,
|
||||
tmat3x4<T, P> const & m);
|
||||
GLM_FUNC_DECL typename tmat3x4<T, P>::row_type operator*(typename tmat3x4<T, P>::col_type const & v, tmat3x4<T, P> const & m);
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tmat4x4<T, P> operator* (
|
||||
tmat3x4<T, P> const & m1,
|
||||
tmat4x3<T, P> const & m2);
|
||||
GLM_FUNC_DECL tmat4x4<T, P> operator*(tmat3x4<T, P> const & m1, tmat4x3<T, P> const & m2);
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tmat2x4<T, P> operator* (
|
||||
tmat3x4<T, P> const & m1,
|
||||
tmat2x3<T, P> const & m2);
|
||||
GLM_FUNC_DECL tmat2x4<T, P> operator*(tmat3x4<T, P> const & m1, tmat2x3<T, P> const & m2);
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tmat3x4<T, P> operator* (
|
||||
tmat3x4<T, P> const & m1,
|
||||
tmat3x3<T, P> const & m2);
|
||||
GLM_FUNC_DECL tmat3x4<T, P> operator*(tmat3x4<T, P> const & m1, tmat3x3<T, P> const & m2);
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tmat3x4<T, P> operator/ (
|
||||
tmat3x4<T, P> const & m,
|
||||
T const & s);
|
||||
GLM_FUNC_DECL tmat3x4<T, P> operator/(tmat3x4<T, P> const & m, T const & s);
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tmat3x4<T, P> operator/ (
|
||||
T const & s,
|
||||
tmat3x4<T, P> const & m);
|
||||
GLM_FUNC_DECL tmat3x4<T, P> operator/(T const & s, tmat3x4<T, P> const & m);
|
||||
|
||||
// Unary constant operators
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tmat3x4<T, P> const operator-(
|
||||
tmat3x4<T, P> const & m);
|
||||
|
||||
}//namespace detail
|
||||
GLM_FUNC_DECL tmat3x4<T, P> const operator-(tmat3x4<T, P> const & m);
|
||||
}//namespace glm
|
||||
|
||||
#ifndef GLM_EXTERNAL_TEMPLATE
|
||||
#include "type_mat3x4.inl"
|
||||
#endif
|
||||
|
||||
#endif //glm_core_type_mat3x4
|
||||
|
||||
@ -12,6 +12,10 @@
|
||||
/// 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
|
||||
@ -21,71 +25,29 @@
|
||||
/// THE SOFTWARE.
|
||||
///
|
||||
/// @ref core
|
||||
/// @file glm/core/type_mat3x4.inl
|
||||
/// @file glm/detail/type_mat3x4.inl
|
||||
/// @date 2006-08-05 / 2011-06-15
|
||||
/// @author Christophe Riccio
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
namespace glm{
|
||||
namespace detail
|
||||
namespace glm
|
||||
{
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR length_t tmat3x4<T, P>::length() const
|
||||
{
|
||||
return 3;
|
||||
}
|
||||
|
||||
//////////////////////////////////////
|
||||
// Accesses
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER typename tmat3x4<T, P>::col_type &
|
||||
tmat3x4<T, P>::operator[]
|
||||
(
|
||||
length_t i
|
||||
)
|
||||
{
|
||||
assert(i < this->length());
|
||||
return this->value[i];
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER typename tmat3x4<T, P>::col_type const &
|
||||
tmat3x4<T, P>::operator[]
|
||||
(
|
||||
length_t i
|
||||
) const
|
||||
{
|
||||
assert(i < this->length());
|
||||
return this->value[i];
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
// Constructors
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat3x4<T, P>::tmat3x4()
|
||||
{
|
||||
this->value[0] = col_type(1, 0, 0, 0);
|
||||
this->value[1] = col_type(0, 1, 0, 0);
|
||||
this->value[2] = col_type(0, 0, 1, 0);
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat3x4<T, P>::tmat3x4
|
||||
(
|
||||
tmat3x4<T, P> const & m
|
||||
)
|
||||
{
|
||||
this->value[0] = m.value[0];
|
||||
this->value[1] = m.value[1];
|
||||
this->value[2] = m.value[2];
|
||||
# ifndef GLM_FORCE_NO_CTOR_INIT
|
||||
this->value[0] = col_type(1, 0, 0, 0);
|
||||
this->value[1] = col_type(0, 1, 0, 0);
|
||||
this->value[2] = col_type(0, 0, 1, 0);
|
||||
# endif
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
template <precision Q>
|
||||
GLM_FUNC_QUALIFIER tmat3x4<T, P>::tmat3x4(
|
||||
tmat3x4<T, Q> const & m)
|
||||
GLM_FUNC_QUALIFIER tmat3x4<T, P>::tmat3x4(tmat3x4<T, Q> const & m)
|
||||
{
|
||||
this->value[0] = m.value[0];
|
||||
this->value[1] = m.value[1];
|
||||
@ -93,17 +55,11 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat3x4<T, P>::tmat3x4
|
||||
(
|
||||
ctor
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat3x4<T, P>::tmat3x4(ctor)
|
||||
{}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat3x4<T, P>::tmat3x4
|
||||
(
|
||||
T const & s
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat3x4<T, P>::tmat3x4(T const & s)
|
||||
{
|
||||
value_type const Zero(0);
|
||||
this->value[0] = col_type(s, Zero, Zero, Zero);
|
||||
@ -173,10 +129,7 @@ namespace detail
|
||||
// Conversion
|
||||
template <typename T, precision P>
|
||||
template <typename U, precision Q>
|
||||
GLM_FUNC_QUALIFIER tmat3x4<T, P>::tmat3x4
|
||||
(
|
||||
tmat3x4<U, Q> const & m
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat3x4<T, P>::tmat3x4(tmat3x4<U, Q> const & m)
|
||||
{
|
||||
this->value[0] = col_type(m[0]);
|
||||
this->value[1] = col_type(m[1]);
|
||||
@ -184,32 +137,23 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat3x4<T, P>::tmat3x4
|
||||
(
|
||||
tmat2x2<T, P> const & m
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat3x4<T, P>::tmat3x4(tmat2x2<T, P> const & m)
|
||||
{
|
||||
this->value[0] = col_type(m[0], detail::tvec2<T, P>(0));
|
||||
this->value[1] = col_type(m[1], detail::tvec2<T, P>(0));
|
||||
this->value[2] = col_type(T(0), T(0), T(1), T(0));
|
||||
this->value[0] = col_type(m[0], 0, 0);
|
||||
this->value[1] = col_type(m[1], 0, 0);
|
||||
this->value[2] = col_type(0, 0, 1, 0);
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat3x4<T, P>::tmat3x4
|
||||
(
|
||||
tmat3x3<T, P> const & m
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat3x4<T, P>::tmat3x4(tmat3x3<T, P> const & m)
|
||||
{
|
||||
this->value[0] = col_type(m[0], T(0));
|
||||
this->value[1] = col_type(m[1], T(0));
|
||||
this->value[2] = col_type(m[2], T(0));
|
||||
this->value[0] = col_type(m[0], 0);
|
||||
this->value[1] = col_type(m[1], 0);
|
||||
this->value[2] = col_type(m[2], 0);
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat3x4<T, P>::tmat3x4
|
||||
(
|
||||
tmat4x4<T, P> const & m
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat3x4<T, P>::tmat3x4(tmat4x4<T, P> const & m)
|
||||
{
|
||||
this->value[0] = col_type(m[0]);
|
||||
this->value[1] = col_type(m[1]);
|
||||
@ -217,65 +161,96 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat3x4<T, P>::tmat3x4
|
||||
(
|
||||
tmat2x3<T, P> const & m
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat3x4<T, P>::tmat3x4(tmat2x3<T, P> const & m)
|
||||
{
|
||||
this->value[0] = col_type(m[0], T(0));
|
||||
this->value[1] = col_type(m[1], T(0));
|
||||
this->value[2] = col_type(T(0), T(0), T(1), T(0));
|
||||
this->value[0] = col_type(m[0], 0);
|
||||
this->value[1] = col_type(m[1], 0);
|
||||
this->value[2] = col_type(0, 0, 1, 0);
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat3x4<T, P>::tmat3x4
|
||||
(
|
||||
tmat3x2<T, P> const & m
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat3x4<T, P>::tmat3x4(tmat3x2<T, P> const & m)
|
||||
{
|
||||
this->value[0] = col_type(m[0], detail::tvec2<T, P>(0));
|
||||
this->value[1] = col_type(m[1], detail::tvec2<T, P>(0));
|
||||
this->value[2] = col_type(m[2], T(0), T(1));
|
||||
this->value[0] = col_type(m[0], 0, 0);
|
||||
this->value[1] = col_type(m[1], 0, 0);
|
||||
this->value[2] = col_type(m[2], 0, 1);
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat3x4<T, P>::tmat3x4
|
||||
(
|
||||
tmat2x4<T, P> const & m
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat3x4<T, P>::tmat3x4(tmat2x4<T, P> const & m)
|
||||
{
|
||||
this->value[0] = col_type(m[0]);
|
||||
this->value[1] = col_type(m[1]);
|
||||
this->value[2] = col_type(T(0), T(0), T(1), T(0));
|
||||
this->value[2] = col_type(0, 0, 1, 0);
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat3x4<T, P>::tmat3x4
|
||||
(
|
||||
tmat4x2<T, P> const & m
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat3x4<T, P>::tmat3x4(tmat4x2<T, P> const & m)
|
||||
{
|
||||
this->value[0] = col_type(m[0], detail::tvec2<T, P>(T(0)));
|
||||
this->value[1] = col_type(m[1], detail::tvec2<T, P>(T(0)));
|
||||
this->value[2] = col_type(m[2], detail::tvec2<T, P>(T(1), T(0)));
|
||||
this->value[0] = col_type(m[0], 0, 0);
|
||||
this->value[1] = col_type(m[1], 0, 0);
|
||||
this->value[2] = col_type(m[2], 1, 0);
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat3x4<T, P>::tmat3x4
|
||||
(
|
||||
tmat4x3<T, P> const & m
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat3x4<T, P>::tmat3x4(tmat4x3<T, P> const & m)
|
||||
{
|
||||
this->value[0] = col_type(m[0], T(0));
|
||||
this->value[1] = col_type(m[1], T(0));
|
||||
this->value[2] = col_type(m[2], T(0));
|
||||
this->value[0] = col_type(m[0], 0);
|
||||
this->value[1] = col_type(m[1], 0);
|
||||
this->value[2] = col_type(m[2], 0);
|
||||
}
|
||||
|
||||
//////////////////////////////////////
|
||||
// Accesses
|
||||
|
||||
# ifdef GLM_FORCE_SIZE_FUNC
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tmat3x4<T, P>::size_type tmat3x4<T, P>::size() const
|
||||
{
|
||||
return 3;
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER typename tmat3x4<T, P>::col_type & tmat3x4<T, P>::operator[](typename tmat3x4<T, P>::size_type i)
|
||||
{
|
||||
assert(i < this->size());
|
||||
return this->value[i];
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER typename tmat3x4<T, P>::col_type const & tmat3x4<T, P>::operator[](typename tmat3x4<T, P>::size_type i) const
|
||||
{
|
||||
assert(i < this->size());
|
||||
return this->value[i];
|
||||
}
|
||||
# else
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tmat3x4<T, P>::length_type tmat3x4<T, P>::length() const
|
||||
{
|
||||
return 3;
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER typename tmat3x4<T, P>::col_type & tmat3x4<T, P>::operator[](typename tmat3x4<T, P>::length_type i)
|
||||
{
|
||||
assert(i < this->length());
|
||||
return this->value[i];
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER typename tmat3x4<T, P>::col_type const & tmat3x4<T, P>::operator[](typename tmat3x4<T, P>::length_type i) const
|
||||
{
|
||||
assert(i < this->length());
|
||||
return this->value[i];
|
||||
}
|
||||
# endif//GLM_FORCE_SIZE_FUNC
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
// Unary updatable operators
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat3x4<T, P>& tmat3x4<T, P>::operator= (tmat3x4<T, P> const & m)
|
||||
template <typename U>
|
||||
GLM_FUNC_QUALIFIER tmat3x4<T, P>& tmat3x4<T, P>::operator=(tmat3x4<U, P> const & m)
|
||||
{
|
||||
this->value[0] = m[0];
|
||||
this->value[1] = m[1];
|
||||
@ -285,17 +260,7 @@ namespace detail
|
||||
|
||||
template <typename T, precision P>
|
||||
template <typename U>
|
||||
GLM_FUNC_QUALIFIER tmat3x4<T, P>& tmat3x4<T, P>::operator= (tmat3x4<U, P> const & m)
|
||||
{
|
||||
this->value[0] = m[0];
|
||||
this->value[1] = m[1];
|
||||
this->value[2] = m[2];
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
template <typename U>
|
||||
GLM_FUNC_QUALIFIER tmat3x4<T, P>& tmat3x4<T, P>::operator+= (U s)
|
||||
GLM_FUNC_QUALIFIER tmat3x4<T, P>& tmat3x4<T, P>::operator+=(U s)
|
||||
{
|
||||
this->value[0] += s;
|
||||
this->value[1] += s;
|
||||
@ -305,7 +270,7 @@ namespace detail
|
||||
|
||||
template <typename T, precision P>
|
||||
template <typename U>
|
||||
GLM_FUNC_QUALIFIER tmat3x4<T, P>& tmat3x4<T, P>::operator+= (tmat3x4<U, P> const & m)
|
||||
GLM_FUNC_QUALIFIER tmat3x4<T, P>& tmat3x4<T, P>::operator+=(tmat3x4<U, P> const & m)
|
||||
{
|
||||
this->value[0] += m[0];
|
||||
this->value[1] += m[1];
|
||||
@ -315,7 +280,7 @@ namespace detail
|
||||
|
||||
template <typename T, precision P>
|
||||
template <typename U>
|
||||
GLM_FUNC_QUALIFIER tmat3x4<T, P>& tmat3x4<T, P>::operator-= (U s)
|
||||
GLM_FUNC_QUALIFIER tmat3x4<T, P>& tmat3x4<T, P>::operator-=(U s)
|
||||
{
|
||||
this->value[0] -= s;
|
||||
this->value[1] -= s;
|
||||
@ -325,7 +290,7 @@ namespace detail
|
||||
|
||||
template <typename T, precision P>
|
||||
template <typename U>
|
||||
GLM_FUNC_QUALIFIER tmat3x4<T, P>& tmat3x4<T, P>::operator-= (tmat3x4<U, P> const & m)
|
||||
GLM_FUNC_QUALIFIER tmat3x4<T, P>& tmat3x4<T, P>::operator-=(tmat3x4<U, P> const & m)
|
||||
{
|
||||
this->value[0] -= m[0];
|
||||
this->value[1] -= m[1];
|
||||
@ -335,7 +300,7 @@ namespace detail
|
||||
|
||||
template <typename T, precision P>
|
||||
template <typename U>
|
||||
GLM_FUNC_QUALIFIER tmat3x4<T, P>& tmat3x4<T, P>::operator*= (U s)
|
||||
GLM_FUNC_QUALIFIER tmat3x4<T, P>& tmat3x4<T, P>::operator*=(U s)
|
||||
{
|
||||
this->value[0] *= s;
|
||||
this->value[1] *= s;
|
||||
@ -345,7 +310,7 @@ namespace detail
|
||||
|
||||
template <typename T, precision P>
|
||||
template <typename U>
|
||||
GLM_FUNC_QUALIFIER tmat3x4<T, P> & tmat3x4<T, P>::operator/= (U s)
|
||||
GLM_FUNC_QUALIFIER tmat3x4<T, P> & tmat3x4<T, P>::operator/=(U s)
|
||||
{
|
||||
this->value[0] /= s;
|
||||
this->value[1] /= s;
|
||||
@ -354,7 +319,7 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat3x4<T, P>& tmat3x4<T, P>::operator++ ()
|
||||
GLM_FUNC_QUALIFIER tmat3x4<T, P>& tmat3x4<T, P>::operator++()
|
||||
{
|
||||
++this->value[0];
|
||||
++this->value[1];
|
||||
@ -363,7 +328,7 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat3x4<T, P>& tmat3x4<T, P>::operator-- ()
|
||||
GLM_FUNC_QUALIFIER tmat3x4<T, P>& tmat3x4<T, P>::operator--()
|
||||
{
|
||||
--this->value[0];
|
||||
--this->value[1];
|
||||
@ -391,11 +356,7 @@ namespace detail
|
||||
// Binary operators
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat3x4<T, P> operator+
|
||||
(
|
||||
tmat3x4<T, P> const & m,
|
||||
T const & s
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat3x4<T, P> operator+(tmat3x4<T, P> const & m, T const & s)
|
||||
{
|
||||
return tmat3x4<T, P>(
|
||||
m[0] + s,
|
||||
@ -404,11 +365,7 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat3x4<T, P> operator+
|
||||
(
|
||||
tmat3x4<T, P> const & m1,
|
||||
tmat3x4<T, P> const & m2
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat3x4<T, P> operator+(tmat3x4<T, P> const & m1, tmat3x4<T, P> const & m2)
|
||||
{
|
||||
return tmat3x4<T, P>(
|
||||
m1[0] + m2[0],
|
||||
@ -417,11 +374,7 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat3x4<T, P> operator-
|
||||
(
|
||||
tmat3x4<T, P> const & m,
|
||||
T const & s
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat3x4<T, P> operator-(tmat3x4<T, P> const & m, T const & s)
|
||||
{
|
||||
return tmat3x4<T, P>(
|
||||
m[0] - s,
|
||||
@ -430,11 +383,7 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat3x4<T, P> operator-
|
||||
(
|
||||
tmat3x4<T, P> const & m1,
|
||||
tmat3x4<T, P> const & m2
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat3x4<T, P> operator-(tmat3x4<T, P> const & m1, tmat3x4<T, P> const & m2)
|
||||
{
|
||||
return tmat3x4<T, P>(
|
||||
m1[0] - m2[0],
|
||||
@ -443,11 +392,7 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat3x4<T, P> operator*
|
||||
(
|
||||
tmat3x4<T, P> const & m,
|
||||
T const & s
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat3x4<T, P> operator*(tmat3x4<T, P> const & m, T const & s)
|
||||
{
|
||||
return tmat3x4<T, P>(
|
||||
m[0] * s,
|
||||
@ -456,11 +401,7 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat3x4<T, P> operator*
|
||||
(
|
||||
T const & s,
|
||||
tmat3x4<T, P> const & m
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat3x4<T, P> operator*(T const & s, tmat3x4<T, P> const & m)
|
||||
{
|
||||
return tmat3x4<T, P>(
|
||||
m[0] * s,
|
||||
@ -496,11 +437,7 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat4x4<T, P> operator*
|
||||
(
|
||||
tmat3x4<T, P> const & m1,
|
||||
tmat4x3<T, P> const & m2
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat4x4<T, P> operator*(tmat3x4<T, P> const & m1, tmat4x3<T, P> const & m2)
|
||||
{
|
||||
const T SrcA00 = m1[0][0];
|
||||
const T SrcA01 = m1[0][1];
|
||||
@ -528,7 +465,7 @@ namespace detail
|
||||
const T SrcB31 = m2[3][1];
|
||||
const T SrcB32 = m2[3][2];
|
||||
|
||||
tmat4x4<T, P> Result(tmat4x4<T, P>::_null);
|
||||
tmat4x4<T, P> Result(uninitialize);
|
||||
Result[0][0] = SrcA00 * SrcB00 + SrcA10 * SrcB01 + SrcA20 * SrcB02;
|
||||
Result[0][1] = SrcA01 * SrcB00 + SrcA11 * SrcB01 + SrcA21 * SrcB02;
|
||||
Result[0][2] = SrcA02 * SrcB00 + SrcA12 * SrcB01 + SrcA22 * SrcB02;
|
||||
@ -549,11 +486,7 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat2x4<T, P> operator*
|
||||
(
|
||||
tmat3x4<T, P> const & m1,
|
||||
tmat2x3<T, P> const & m2
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat2x4<T, P> operator*(tmat3x4<T, P> const & m1, tmat2x3<T, P> const & m2)
|
||||
{
|
||||
return tmat2x4<T, P>(
|
||||
m1[0][0] * m2[0][0] + m1[1][0] * m2[0][1] + m1[2][0] * m2[0][2],
|
||||
@ -567,11 +500,7 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat3x4<T, P> operator*
|
||||
(
|
||||
tmat3x4<T, P> const & m1,
|
||||
tmat3x3<T, P> const & m2
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat3x4<T, P> operator*(tmat3x4<T, P> const & m1, tmat3x3<T, P> const & m2)
|
||||
{
|
||||
return tmat3x4<T, P>(
|
||||
m1[0][0] * m2[0][0] + m1[1][0] * m2[0][1] + m1[2][0] * m2[0][2],
|
||||
@ -589,11 +518,7 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat3x4<T, P> operator/
|
||||
(
|
||||
tmat3x4<T, P> const & m,
|
||||
T const & s
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat3x4<T, P> operator/(tmat3x4<T, P> const & m, T const & s)
|
||||
{
|
||||
return tmat3x4<T, P>(
|
||||
m[0] / s,
|
||||
@ -602,11 +527,7 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat3x4<T, P> operator/
|
||||
(
|
||||
T const & s,
|
||||
tmat3x4<T, P> const & m
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat3x4<T, P> operator/(T const & s, tmat3x4<T, P> const & m)
|
||||
{
|
||||
return tmat3x4<T, P>(
|
||||
s / m[0],
|
||||
@ -616,10 +537,7 @@ namespace detail
|
||||
|
||||
// Unary constant operators
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat3x4<T, P> const operator-
|
||||
(
|
||||
tmat3x4<T, P> const & m
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat3x4<T, P> const operator-(tmat3x4<T, P> const & m)
|
||||
{
|
||||
return tmat3x4<T, P>(
|
||||
-m[0],
|
||||
@ -631,23 +549,14 @@ namespace detail
|
||||
// Boolean operators
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER bool operator==
|
||||
(
|
||||
tmat3x4<T, P> const & m1,
|
||||
tmat3x4<T, P> const & m2
|
||||
)
|
||||
GLM_FUNC_QUALIFIER bool operator==(tmat3x4<T, P> const & m1, tmat3x4<T, P> const & m2)
|
||||
{
|
||||
return (m1[0] == m2[0]) && (m1[1] == m2[1]) && (m1[2] == m2[2]);
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER bool operator!=
|
||||
(
|
||||
tmat3x4<T, P> const & m1,
|
||||
tmat3x4<T, P> const & m2
|
||||
)
|
||||
GLM_FUNC_QUALIFIER bool operator!=(tmat3x4<T, P> const & m1, tmat3x4<T, P> const & m2)
|
||||
{
|
||||
return (m1[0] != m2[0]) || (m1[1] != m2[1]) || (m1[2] != m2[2]);
|
||||
}
|
||||
} //namespace detail
|
||||
} //namespace glm
|
||||
|
||||
@ -12,6 +12,10 @@
|
||||
/// 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
|
||||
@ -21,51 +25,44 @@
|
||||
/// THE SOFTWARE.
|
||||
///
|
||||
/// @ref core
|
||||
/// @file glm/core/type_mat4x2.hpp
|
||||
/// @file glm/detail/type_mat4x2.hpp
|
||||
/// @date 2006-10-01 / 2011-06-15
|
||||
/// @author Christophe Riccio
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef glm_core_type_mat4x2
|
||||
#define glm_core_type_mat4x2
|
||||
#pragma once
|
||||
|
||||
#include "../fwd.hpp"
|
||||
#include "type_vec2.hpp"
|
||||
#include "type_vec4.hpp"
|
||||
#include "type_mat.hpp"
|
||||
#include <limits>
|
||||
#include <cstddef>
|
||||
|
||||
namespace glm{
|
||||
namespace detail
|
||||
namespace glm
|
||||
{
|
||||
template <typename T, precision P>
|
||||
template <typename T, precision P = defaultp>
|
||||
struct tmat4x2
|
||||
{
|
||||
enum ctor{_null};
|
||||
typedef T value_type;
|
||||
typedef std::size_t size_type;
|
||||
typedef tvec2<T, P> col_type;
|
||||
typedef tvec4<T, P> row_type;
|
||||
typedef tmat4x2<T, P> type;
|
||||
typedef tmat2x4<T, P> transpose_type;
|
||||
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const;
|
||||
typedef T value_type;
|
||||
|
||||
private:
|
||||
// Data
|
||||
/// @cond DETAIL
|
||||
col_type value[4];
|
||||
/// @endcond
|
||||
|
||||
public:
|
||||
// Constructors
|
||||
GLM_FUNC_DECL tmat4x2();
|
||||
GLM_FUNC_DECL tmat4x2(tmat4x2<T, P> const & m);
|
||||
template <precision Q>
|
||||
GLM_FUNC_DECL tmat4x2(tmat4x2<T, Q> const & m);
|
||||
|
||||
GLM_FUNC_DECL explicit tmat4x2(
|
||||
ctor Null);
|
||||
GLM_FUNC_DECL explicit tmat4x2(
|
||||
T const & x);
|
||||
GLM_FUNC_DECL explicit tmat4x2(ctor);
|
||||
GLM_FUNC_DECL explicit tmat4x2(T const & x);
|
||||
GLM_FUNC_DECL tmat4x2(
|
||||
T const & x0, T const & y0,
|
||||
T const & x1, T const & y1,
|
||||
@ -80,7 +77,7 @@ namespace detail
|
||||
//////////////////////////////////////
|
||||
// Conversions
|
||||
|
||||
template<
|
||||
template <
|
||||
typename X1, typename Y1,
|
||||
typename X2, typename Y2,
|
||||
typename X3, typename Y3,
|
||||
@ -98,9 +95,16 @@ namespace detail
|
||||
tvec2<V3, P> const & v3,
|
||||
tvec2<V4, P> const & v4);
|
||||
|
||||
//////////////////////////////////////
|
||||
// Matrix conversions
|
||||
template <typename U, precision Q>
|
||||
GLM_FUNC_DECL explicit tmat4x2(tmat4x2<U, Q> const & m);
|
||||
|
||||
# ifdef GLM_FORCE_EXPLICIT_CTOR
|
||||
template <typename U, precision Q>
|
||||
GLM_FUNC_DECL explicit tmat4x2(tmat4x2<U, Q> const & m);
|
||||
# else
|
||||
template <typename U, precision Q>
|
||||
GLM_FUNC_DECL tmat4x2(tmat4x2<U, Q> const & m);
|
||||
# endif
|
||||
|
||||
GLM_FUNC_DECL explicit tmat4x2(tmat2x2<T, P> const & x);
|
||||
GLM_FUNC_DECL explicit tmat4x2(tmat3x3<T, P> const & x);
|
||||
@ -111,26 +115,40 @@ namespace detail
|
||||
GLM_FUNC_DECL explicit tmat4x2(tmat4x3<T, P> const & x);
|
||||
GLM_FUNC_DECL explicit tmat4x2(tmat3x4<T, P> const & x);
|
||||
|
||||
//////////////////////////////////////
|
||||
// Accesses
|
||||
GLM_FUNC_DECL col_type & operator[](length_t i);
|
||||
GLM_FUNC_DECL col_type const & operator[](length_t i) const;
|
||||
|
||||
// Unary updatable operators
|
||||
GLM_FUNC_DECL tmat4x2<T, P>& operator= (tmat4x2<T, P> const & m);
|
||||
# ifdef GLM_FORCE_SIZE_FUNC
|
||||
typedef size_t size_type;
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR size_t size() const;
|
||||
|
||||
GLM_FUNC_DECL col_type & operator[](size_type i);
|
||||
GLM_FUNC_DECL col_type const & operator[](size_type i) const;
|
||||
# else
|
||||
typedef length_t length_type;
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR length_type length() const;
|
||||
|
||||
GLM_FUNC_DECL col_type & operator[](length_type i);
|
||||
GLM_FUNC_DECL col_type const & operator[](length_type i) const;
|
||||
# endif//GLM_FORCE_SIZE_FUNC
|
||||
|
||||
//////////////////////////////////////
|
||||
// Unary arithmetic operators
|
||||
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tmat4x2<T, P>& operator= (tmat4x2<U, P> const & m);
|
||||
GLM_FUNC_DECL tmat4x2<T, P>& operator=(tmat4x2<U, P> const & m);
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tmat4x2<T, P>& operator+= (U s);
|
||||
GLM_FUNC_DECL tmat4x2<T, P>& operator+=(U s);
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tmat4x2<T, P>& operator+= (tmat4x2<U, P> const & m);
|
||||
GLM_FUNC_DECL tmat4x2<T, P>& operator+=(tmat4x2<U, P> const & m);
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tmat4x2<T, P>& operator-= (U s);
|
||||
GLM_FUNC_DECL tmat4x2<T, P>& operator-=(U s);
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tmat4x2<T, P>& operator-= (tmat4x2<U, P> const & m);
|
||||
GLM_FUNC_DECL tmat4x2<T, P>& operator-=(tmat4x2<U, P> const & m);
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tmat4x2<T, P>& operator*= (U s);
|
||||
GLM_FUNC_DECL tmat4x2<T, P>& operator*=(U s);
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tmat4x2<T, P>& operator/= (U s);
|
||||
GLM_FUNC_DECL tmat4x2<T, P>& operator/=(U s);
|
||||
|
||||
//////////////////////////////////////
|
||||
// Increment and decrement operators
|
||||
@ -143,80 +161,49 @@ namespace detail
|
||||
|
||||
// Binary operators
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tmat4x2<T, P> operator+ (
|
||||
tmat4x2<T, P> const & m,
|
||||
T const & s);
|
||||
GLM_FUNC_DECL tmat4x2<T, P> operator+(tmat4x2<T, P> const & m, T const & s);
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tmat4x2<T, P> operator+ (
|
||||
tmat4x2<T, P> const & m1,
|
||||
tmat4x2<T, P> const & m2);
|
||||
GLM_FUNC_DECL tmat4x2<T, P> operator+(tmat4x2<T, P> const & m1, tmat4x2<T, P> const & m2);
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tmat4x2<T, P> operator- (
|
||||
tmat4x2<T, P> const & m,
|
||||
T const & s);
|
||||
GLM_FUNC_DECL tmat4x2<T, P> operator-(tmat4x2<T, P> const & m, T const & s);
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tmat4x2<T, P> operator- (
|
||||
tmat4x2<T, P> const & m1,
|
||||
tmat4x2<T, P> const & m2);
|
||||
GLM_FUNC_DECL tmat4x2<T, P> operator-(tmat4x2<T, P> const & m1, tmat4x2<T, P> const & m2);
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tmat4x2<T, P> operator* (
|
||||
tmat4x2<T, P> const & m,
|
||||
T const & s);
|
||||
GLM_FUNC_DECL tmat4x2<T, P> operator*(tmat4x2<T, P> const & m, T const & s);
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tmat4x2<T, P> operator* (
|
||||
T const & s,
|
||||
tmat4x2<T, P> const & m);
|
||||
GLM_FUNC_DECL tmat4x2<T, P> operator*(T const & s, tmat4x2<T, P> const & m);
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL typename tmat4x2<T, P>::col_type operator* (
|
||||
tmat4x2<T, P> const & m,
|
||||
typename tmat4x2<T, P>::row_type const & v);
|
||||
GLM_FUNC_DECL typename tmat4x2<T, P>::col_type operator*(tmat4x2<T, P> const & m, typename tmat4x2<T, P>::row_type const & v);
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL typename tmat4x2<T, P>::row_type operator* (
|
||||
typename tmat4x2<T, P>::col_type const & v,
|
||||
tmat4x2<T, P> const & m);
|
||||
GLM_FUNC_DECL typename tmat4x2<T, P>::row_type operator*(typename tmat4x2<T, P>::col_type const & v, tmat4x2<T, P> const & m);
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tmat3x2<T, P> operator* (
|
||||
tmat4x2<T, P> const & m1,
|
||||
tmat3x4<T, P> const & m2);
|
||||
GLM_FUNC_DECL tmat3x2<T, P> operator*(tmat4x2<T, P> const & m1, tmat3x4<T, P> const & m2);
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tmat4x2<T, P> operator* (
|
||||
tmat4x2<T, P> const & m1,
|
||||
tmat4x4<T, P> const & m2);
|
||||
GLM_FUNC_DECL tmat4x2<T, P> operator*(tmat4x2<T, P> const & m1, tmat4x4<T, P> const & m2);
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tmat2x3<T, P> operator* (
|
||||
tmat4x3<T, P> const & m1,
|
||||
tmat2x4<T, P> const & m2);
|
||||
GLM_FUNC_DECL tmat2x3<T, P> operator*(tmat4x3<T, P> const & m1, tmat2x4<T, P> const & m2);
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tmat4x2<T, P> operator/ (
|
||||
tmat4x2<T, P> const & m,
|
||||
T const & s);
|
||||
GLM_FUNC_DECL tmat4x2<T, P> operator/(tmat4x2<T, P> const & m, T const & s);
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tmat4x2<T, P> operator/ (
|
||||
T const & s,
|
||||
tmat4x2<T, P> const & m);
|
||||
GLM_FUNC_DECL tmat4x2<T, P> operator/(T const & s, tmat4x2<T, P> const & m);
|
||||
|
||||
// Unary constant operators
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tmat4x2<T, P> const operator-(
|
||||
tmat4x2<T, P> const & m);
|
||||
|
||||
}//namespace detail
|
||||
GLM_FUNC_DECL tmat4x2<T, P> const operator-(tmat4x2<T, P> const & m);
|
||||
}//namespace glm
|
||||
|
||||
#ifndef GLM_EXTERNAL_TEMPLATE
|
||||
#include "type_mat4x2.inl"
|
||||
#endif
|
||||
|
||||
#endif //glm_core_type_mat4x2
|
||||
|
||||
@ -12,6 +12,10 @@
|
||||
/// 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
|
||||
@ -21,73 +25,30 @@
|
||||
/// THE SOFTWARE.
|
||||
///
|
||||
/// @ref core
|
||||
/// @file glm/core/type_mat4x2.inl
|
||||
/// @file glm/detail/type_mat4x2.inl
|
||||
/// @date 2006-10-01 / 2011-06-15
|
||||
/// @author Christophe Riccio
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
namespace glm{
|
||||
namespace detail
|
||||
namespace glm
|
||||
{
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR length_t tmat4x2<T, P>::length() const
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
|
||||
//////////////////////////////////////
|
||||
// Accesses
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER typename tmat4x2<T, P>::col_type &
|
||||
tmat4x2<T, P>::operator[]
|
||||
(
|
||||
length_t i
|
||||
)
|
||||
{
|
||||
assert(i < this->length());
|
||||
return this->value[i];
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER typename tmat4x2<T, P>::col_type const &
|
||||
tmat4x2<T, P>::operator[]
|
||||
(
|
||||
length_t i
|
||||
) const
|
||||
{
|
||||
assert(i < this->length());
|
||||
return this->value[i];
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
// Constructors
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat4x2<T, P>::tmat4x2()
|
||||
{
|
||||
value_type const Zero(0);
|
||||
value_type const One(1);
|
||||
this->value[0] = col_type(One, Zero);
|
||||
this->value[1] = col_type(Zero, One);
|
||||
this->value[2] = col_type(Zero, Zero);
|
||||
this->value[3] = col_type(Zero, Zero);
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat4x2<T, P>::tmat4x2(
|
||||
tmat4x2<T, P> const & m)
|
||||
{
|
||||
this->value[0] = m.value[0];
|
||||
this->value[1] = m.value[1];
|
||||
this->value[2] = m.value[2];
|
||||
this->value[3] = m.value[3];
|
||||
# ifndef GLM_FORCE_NO_CTOR_INIT
|
||||
this->value[0] = col_type(1, 0);
|
||||
this->value[1] = col_type(0, 1);
|
||||
this->value[2] = col_type(0, 0);
|
||||
this->value[3] = col_type(0, 0);
|
||||
# endif
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
template <precision Q>
|
||||
GLM_FUNC_QUALIFIER tmat4x2<T, P>::tmat4x2(
|
||||
tmat4x2<T, Q> const & m)
|
||||
GLM_FUNC_QUALIFIER tmat4x2<T, P>::tmat4x2(tmat4x2<T, Q> const & m)
|
||||
{
|
||||
this->value[0] = m.value[0];
|
||||
this->value[1] = m.value[1];
|
||||
@ -100,10 +61,7 @@ namespace detail
|
||||
{}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat4x2<T, P>::tmat4x2
|
||||
(
|
||||
T const & s
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat4x2<T, P>::tmat4x2(T const & s)
|
||||
{
|
||||
value_type const Zero(0);
|
||||
this->value[0] = col_type(s, Zero);
|
||||
@ -185,10 +143,7 @@ namespace detail
|
||||
// Conversion
|
||||
template <typename T, precision P>
|
||||
template <typename U, precision Q>
|
||||
GLM_FUNC_QUALIFIER tmat4x2<T, P>::tmat4x2
|
||||
(
|
||||
tmat4x2<U, Q> const & m
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat4x2<T, P>::tmat4x2(tmat4x2<U, Q> const & m)
|
||||
{
|
||||
this->value[0] = col_type(m[0]);
|
||||
this->value[1] = col_type(m[1]);
|
||||
@ -197,34 +152,25 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat4x2<T, P>::tmat4x2
|
||||
(
|
||||
tmat2x2<T, P> const & m
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat4x2<T, P>::tmat4x2(tmat2x2<T, P> const & m)
|
||||
{
|
||||
this->value[0] = col_type(m[0]);
|
||||
this->value[1] = col_type(m[1]);
|
||||
this->value[2] = col_type(static_cast<T>(0));
|
||||
this->value[3] = col_type(static_cast<T>(0));
|
||||
this->value[2] = col_type(0);
|
||||
this->value[3] = col_type(0);
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat4x2<T, P>::tmat4x2
|
||||
(
|
||||
tmat3x3<T, P> const & m
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat4x2<T, P>::tmat4x2(tmat3x3<T, P> const & m)
|
||||
{
|
||||
this->value[0] = col_type(m[0]);
|
||||
this->value[1] = col_type(m[1]);
|
||||
this->value[2] = col_type(m[2]);
|
||||
this->value[3] = col_type(static_cast<T>(0));
|
||||
this->value[3] = col_type(0);
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat4x2<T, P>::tmat4x2
|
||||
(
|
||||
tmat4x4<T, P> const & m
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat4x2<T, P>::tmat4x2(tmat4x4<T, P> const & m)
|
||||
{
|
||||
this->value[0] = col_type(m[0]);
|
||||
this->value[1] = col_type(m[1]);
|
||||
@ -233,46 +179,34 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat4x2<T, P>::tmat4x2
|
||||
(
|
||||
tmat2x3<T, P> const & m
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat4x2<T, P>::tmat4x2(tmat2x3<T, P> const & m)
|
||||
{
|
||||
this->value[0] = col_type(m[0]);
|
||||
this->value[1] = col_type(m[1]);
|
||||
this->value[2] = col_type(static_cast<T>(0));
|
||||
this->value[3] = col_type(static_cast<T>(0));
|
||||
this->value[2] = col_type(0);
|
||||
this->value[3] = col_type(0);
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat4x2<T, P>::tmat4x2
|
||||
(
|
||||
tmat3x2<T, P> const & m
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat4x2<T, P>::tmat4x2(tmat3x2<T, P> const & m)
|
||||
{
|
||||
this->value[0] = col_type(m[0]);
|
||||
this->value[1] = col_type(m[1]);
|
||||
this->value[2] = col_type(m[2]);
|
||||
this->value[3] = col_type(static_cast<T>(0));
|
||||
this->value[3] = col_type(0);
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat4x2<T, P>::tmat4x2
|
||||
(
|
||||
tmat2x4<T, P> const & m
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat4x2<T, P>::tmat4x2(tmat2x4<T, P> const & m)
|
||||
{
|
||||
this->value[0] = col_type(m[0]);
|
||||
this->value[1] = col_type(m[1]);
|
||||
this->value[2] = col_type(static_cast<T>(0));
|
||||
this->value[3] = col_type(static_cast<T>(0));
|
||||
this->value[2] = col_type(0);
|
||||
this->value[3] = col_type(0);
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat4x2<T, P>::tmat4x2
|
||||
(
|
||||
tmat4x3<T, P> const & m
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat4x2<T, P>::tmat4x2(tmat4x3<T, P> const & m)
|
||||
{
|
||||
this->value[0] = col_type(m[0]);
|
||||
this->value[1] = col_type(m[1]);
|
||||
@ -281,25 +215,65 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat4x2<T, P>::tmat4x2
|
||||
(
|
||||
tmat3x4<T, P> const & m
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat4x2<T, P>::tmat4x2(tmat3x4<T, P> const & m)
|
||||
{
|
||||
this->value[0] = col_type(m[0]);
|
||||
this->value[1] = col_type(m[1]);
|
||||
this->value[2] = col_type(m[2]);
|
||||
this->value[3] = col_type(static_cast<T>(0));
|
||||
this->value[3] = col_type(0);
|
||||
}
|
||||
|
||||
//////////////////////////////////////
|
||||
// Accesses
|
||||
|
||||
# ifdef GLM_FORCE_SIZE_FUNC
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tmat4x2<T, P>::size_type tmat4x2<T, P>::size() const
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER typename tmat4x2<T, P>::col_type & tmat4x2<T, P>::operator[](typename tmat4x2<T, P>::size_type i)
|
||||
{
|
||||
assert(i < this->size());
|
||||
return this->value[i];
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER typename tmat4x2<T, P>::col_type const & tmat4x2<T, P>::operator[](typename tmat4x2<T, P>::size_type i) const
|
||||
{
|
||||
assert(i < this->size());
|
||||
return this->value[i];
|
||||
}
|
||||
# else
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tmat4x2<T, P>::length_type tmat4x2<T, P>::length() const
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER typename tmat4x2<T, P>::col_type & tmat4x2<T, P>::operator[](typename tmat4x2<T, P>::length_type i)
|
||||
{
|
||||
assert(i < this->length());
|
||||
return this->value[i];
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER typename tmat4x2<T, P>::col_type const & tmat4x2<T, P>::operator[](typename tmat4x2<T, P>::length_type i) const
|
||||
{
|
||||
assert(i < this->length());
|
||||
return this->value[i];
|
||||
}
|
||||
# endif//GLM_FORCE_SIZE_FUNC
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
// Unary updatable operators
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat4x2<T, P>& tmat4x2<T, P>::operator=
|
||||
(
|
||||
tmat4x2<T, P> const & m
|
||||
)
|
||||
template <typename U>
|
||||
GLM_FUNC_QUALIFIER tmat4x2<T, P>& tmat4x2<T, P>::operator=(tmat4x2<U, P> const & m)
|
||||
{
|
||||
this->value[0] = m[0];
|
||||
this->value[1] = m[1];
|
||||
@ -310,21 +284,7 @@ namespace detail
|
||||
|
||||
template <typename T, precision P>
|
||||
template <typename U>
|
||||
GLM_FUNC_QUALIFIER tmat4x2<T, P>& tmat4x2<T, P>::operator=
|
||||
(
|
||||
tmat4x2<U, P> const & m
|
||||
)
|
||||
{
|
||||
this->value[0] = m[0];
|
||||
this->value[1] = m[1];
|
||||
this->value[2] = m[2];
|
||||
this->value[3] = m[3];
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
template <typename U>
|
||||
GLM_FUNC_QUALIFIER tmat4x2<T, P> & tmat4x2<T, P>::operator+= (U s)
|
||||
GLM_FUNC_QUALIFIER tmat4x2<T, P> & tmat4x2<T, P>::operator+=(U s)
|
||||
{
|
||||
this->value[0] += s;
|
||||
this->value[1] += s;
|
||||
@ -335,7 +295,7 @@ namespace detail
|
||||
|
||||
template <typename T, precision P>
|
||||
template <typename U>
|
||||
GLM_FUNC_QUALIFIER tmat4x2<T, P> & tmat4x2<T, P>::operator+= (tmat4x2<U, P> const & m)
|
||||
GLM_FUNC_QUALIFIER tmat4x2<T, P> & tmat4x2<T, P>::operator+=(tmat4x2<U, P> const & m)
|
||||
{
|
||||
this->value[0] += m[0];
|
||||
this->value[1] += m[1];
|
||||
@ -346,7 +306,7 @@ namespace detail
|
||||
|
||||
template <typename T, precision P>
|
||||
template <typename U>
|
||||
GLM_FUNC_QUALIFIER tmat4x2<T, P> & tmat4x2<T, P>::operator-= (U s)
|
||||
GLM_FUNC_QUALIFIER tmat4x2<T, P> & tmat4x2<T, P>::operator-=(U s)
|
||||
{
|
||||
this->value[0] -= s;
|
||||
this->value[1] -= s;
|
||||
@ -357,7 +317,7 @@ namespace detail
|
||||
|
||||
template <typename T, precision P>
|
||||
template <typename U>
|
||||
GLM_FUNC_QUALIFIER tmat4x2<T, P> & tmat4x2<T, P>::operator-= (tmat4x2<U, P> const & m)
|
||||
GLM_FUNC_QUALIFIER tmat4x2<T, P> & tmat4x2<T, P>::operator-=(tmat4x2<U, P> const & m)
|
||||
{
|
||||
this->value[0] -= m[0];
|
||||
this->value[1] -= m[1];
|
||||
@ -368,7 +328,7 @@ namespace detail
|
||||
|
||||
template <typename T, precision P>
|
||||
template <typename U>
|
||||
GLM_FUNC_QUALIFIER tmat4x2<T, P> & tmat4x2<T, P>::operator*= (U s)
|
||||
GLM_FUNC_QUALIFIER tmat4x2<T, P> & tmat4x2<T, P>::operator*=(U s)
|
||||
{
|
||||
this->value[0] *= s;
|
||||
this->value[1] *= s;
|
||||
@ -379,7 +339,7 @@ namespace detail
|
||||
|
||||
template <typename T, precision P>
|
||||
template <typename U>
|
||||
GLM_FUNC_QUALIFIER tmat4x2<T, P> & tmat4x2<T, P>::operator/= (U s)
|
||||
GLM_FUNC_QUALIFIER tmat4x2<T, P> & tmat4x2<T, P>::operator/=(U s)
|
||||
{
|
||||
this->value[0] /= s;
|
||||
this->value[1] /= s;
|
||||
@ -389,7 +349,7 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat4x2<T, P> & tmat4x2<T, P>::operator++ ()
|
||||
GLM_FUNC_QUALIFIER tmat4x2<T, P> & tmat4x2<T, P>::operator++()
|
||||
{
|
||||
++this->value[0];
|
||||
++this->value[1];
|
||||
@ -399,7 +359,7 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat4x2<T, P> & tmat4x2<T, P>::operator-- ()
|
||||
GLM_FUNC_QUALIFIER tmat4x2<T, P> & tmat4x2<T, P>::operator--()
|
||||
{
|
||||
--this->value[0];
|
||||
--this->value[1];
|
||||
@ -428,11 +388,7 @@ namespace detail
|
||||
// Binary operators
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat4x2<T, P> operator+
|
||||
(
|
||||
tmat4x2<T, P> const & m,
|
||||
T const & s
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat4x2<T, P> operator+(tmat4x2<T, P> const & m, T const & s)
|
||||
{
|
||||
return tmat4x2<T, P>(
|
||||
m[0] + s,
|
||||
@ -442,11 +398,7 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat4x2<T, P> operator+
|
||||
(
|
||||
tmat4x2<T, P> const & m1,
|
||||
tmat4x2<T, P> const & m2
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat4x2<T, P> operator+(tmat4x2<T, P> const & m1, tmat4x2<T, P> const & m2)
|
||||
{
|
||||
return tmat4x2<T, P>(
|
||||
m1[0] + m2[0],
|
||||
@ -456,11 +408,7 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat4x2<T, P> operator-
|
||||
(
|
||||
tmat4x2<T, P> const & m,
|
||||
T const & s
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat4x2<T, P> operator-(tmat4x2<T, P> const & m, T const & s)
|
||||
{
|
||||
return tmat4x2<T, P>(
|
||||
m[0] - s,
|
||||
@ -470,11 +418,7 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat4x2<T, P> operator-
|
||||
(
|
||||
tmat4x2<T, P> const & m1,
|
||||
tmat4x2<T, P> const & m2
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat4x2<T, P> operator-(tmat4x2<T, P> const & m1, tmat4x2<T, P> const & m2)
|
||||
{
|
||||
return tmat4x2<T, P>(
|
||||
m1[0] - m2[0],
|
||||
@ -484,11 +428,7 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat4x2<T, P> operator*
|
||||
(
|
||||
tmat4x2<T, P> const & m,
|
||||
T const & s
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat4x2<T, P> operator*(tmat4x2<T, P> const & m, T const & s)
|
||||
{
|
||||
return tmat4x2<T, P>(
|
||||
m[0] * s,
|
||||
@ -498,11 +438,7 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat4x2<T, P> operator*
|
||||
(
|
||||
T const & s,
|
||||
tmat4x2<T, P> const & m
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat4x2<T, P> operator*(T const & s, tmat4x2<T, P> const & m)
|
||||
{
|
||||
return tmat4x2<T, P>(
|
||||
m[0] * s,
|
||||
@ -512,11 +448,7 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER typename tmat4x2<T, P>::col_type operator*
|
||||
(
|
||||
tmat4x2<T, P> const & m,
|
||||
typename tmat4x2<T, P>::row_type const & v
|
||||
)
|
||||
GLM_FUNC_QUALIFIER typename tmat4x2<T, P>::col_type operator*(tmat4x2<T, P> const & m, typename tmat4x2<T, P>::row_type const & v)
|
||||
{
|
||||
return typename tmat4x2<T, P>::col_type(
|
||||
m[0][0] * v.x + m[1][0] * v.y + m[2][0] * v.z + m[3][0] * v.w,
|
||||
@ -524,11 +456,7 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER typename tmat4x2<T, P>::row_type operator*
|
||||
(
|
||||
typename tmat4x2<T, P>::col_type const & v,
|
||||
tmat4x2<T, P> const & m
|
||||
)
|
||||
GLM_FUNC_QUALIFIER typename tmat4x2<T, P>::row_type operator*(typename tmat4x2<T, P>::col_type const & v, tmat4x2<T, P> const & m)
|
||||
{
|
||||
return typename tmat4x2<T, P>::row_type(
|
||||
v.x * m[0][0] + v.y * m[0][1],
|
||||
@ -538,11 +466,7 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat2x2<T, P> operator*
|
||||
(
|
||||
tmat4x2<T, P> const & m1,
|
||||
tmat2x4<T, P> const & m2
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat2x2<T, P> operator*(tmat4x2<T, P> const & m1, tmat2x4<T, P> const & m2)
|
||||
{
|
||||
T const SrcA00 = m1[0][0];
|
||||
T const SrcA01 = m1[0][1];
|
||||
@ -562,7 +486,7 @@ namespace detail
|
||||
T const SrcB12 = m2[1][2];
|
||||
T const SrcB13 = m2[1][3];
|
||||
|
||||
tmat2x2<T, P> Result(tmat2x2<T, P>::_null);
|
||||
tmat2x2<T, P> Result(uninitialize);
|
||||
Result[0][0] = SrcA00 * SrcB00 + SrcA10 * SrcB01 + SrcA20 * SrcB02 + SrcA30 * SrcB03;
|
||||
Result[0][1] = SrcA01 * SrcB00 + SrcA11 * SrcB01 + SrcA21 * SrcB02 + SrcA31 * SrcB03;
|
||||
Result[1][0] = SrcA00 * SrcB10 + SrcA10 * SrcB11 + SrcA20 * SrcB12 + SrcA30 * SrcB13;
|
||||
@ -571,11 +495,7 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat3x2<T, P> operator*
|
||||
(
|
||||
tmat4x2<T, P> const & m1,
|
||||
tmat3x4<T, P> const & m2
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat3x2<T, P> operator*(tmat4x2<T, P> const & m1, tmat3x4<T, P> const & m2)
|
||||
{
|
||||
return tmat3x2<T, P>(
|
||||
m1[0][0] * m2[0][0] + m1[1][0] * m2[0][1] + m1[2][0] * m2[0][2] + m1[3][0] * m2[0][3],
|
||||
@ -587,11 +507,7 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat4x2<T, P> operator*
|
||||
(
|
||||
tmat4x2<T, P> const & m1,
|
||||
tmat4x4<T, P> const & m2
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat4x2<T, P> operator*(tmat4x2<T, P> const & m1, tmat4x4<T, P> const & m2)
|
||||
{
|
||||
return tmat4x2<T, P>(
|
||||
m1[0][0] * m2[0][0] + m1[1][0] * m2[0][1] + m1[2][0] * m2[0][2] + m1[3][0] * m2[0][3],
|
||||
@ -605,11 +521,7 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat4x2<T, P> operator/
|
||||
(
|
||||
tmat4x2<T, P> const & m,
|
||||
T const & s
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat4x2<T, P> operator/(tmat4x2<T, P> const & m, T const & s)
|
||||
{
|
||||
return tmat4x2<T, P>(
|
||||
m[0] / s,
|
||||
@ -619,11 +531,7 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat4x2<T, P> operator/
|
||||
(
|
||||
T const & s,
|
||||
tmat4x2<T, P> const & m
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat4x2<T, P> operator/(T const & s, tmat4x2<T, P> const & m)
|
||||
{
|
||||
return tmat4x2<T, P>(
|
||||
s / m[0],
|
||||
@ -634,10 +542,7 @@ namespace detail
|
||||
|
||||
// Unary constant operators
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat4x2<T, P> const operator-
|
||||
(
|
||||
tmat4x2<T, P> const & m
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat4x2<T, P> const operator-(tmat4x2<T, P> const & m)
|
||||
{
|
||||
return tmat4x2<T, P>(
|
||||
-m[0],
|
||||
@ -650,23 +555,14 @@ namespace detail
|
||||
// Boolean operators
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER bool operator==
|
||||
(
|
||||
tmat4x2<T, P> const & m1,
|
||||
tmat4x2<T, P> const & m2
|
||||
)
|
||||
GLM_FUNC_QUALIFIER bool operator==(tmat4x2<T, P> const & m1, tmat4x2<T, P> const & m2)
|
||||
{
|
||||
return (m1[0] == m2[0]) && (m1[1] == m2[1]) && (m1[2] == m2[2]) && (m1[3] == m2[3]);
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER bool operator!=
|
||||
(
|
||||
tmat4x2<T, P> const & m1,
|
||||
tmat4x2<T, P> const & m2
|
||||
)
|
||||
GLM_FUNC_QUALIFIER bool operator!=(tmat4x2<T, P> const & m1, tmat4x2<T, P> const & m2)
|
||||
{
|
||||
return (m1[0] != m2[0]) || (m1[1] != m2[1]) || (m1[2] != m2[2]) || (m1[3] != m2[3]);
|
||||
}
|
||||
} //namespace detail
|
||||
} //namespace glm
|
||||
|
||||
@ -12,6 +12,10 @@
|
||||
/// 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
|
||||
@ -21,35 +25,30 @@
|
||||
/// THE SOFTWARE.
|
||||
///
|
||||
/// @ref core
|
||||
/// @file glm/core/type_mat4x3.hpp
|
||||
/// @file glm/detail/type_mat4x3.hpp
|
||||
/// @date 2006-08-04 / 2011-06-15
|
||||
/// @author Christophe Riccio
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef glm_core_type_mat4x3
|
||||
#define glm_core_type_mat4x3
|
||||
#pragma once
|
||||
|
||||
#include "../fwd.hpp"
|
||||
#include "type_vec3.hpp"
|
||||
#include "type_vec4.hpp"
|
||||
#include "type_mat.hpp"
|
||||
#include <limits>
|
||||
#include <cstddef>
|
||||
|
||||
namespace glm{
|
||||
namespace detail
|
||||
namespace glm
|
||||
{
|
||||
template <typename T, precision P>
|
||||
template <typename T, precision P = defaultp>
|
||||
struct tmat4x3
|
||||
{
|
||||
enum ctor{_null};
|
||||
typedef T value_type;
|
||||
typedef std::size_t size_type;
|
||||
typedef tvec3<T, P> col_type;
|
||||
typedef tvec4<T, P> row_type;
|
||||
typedef tmat4x3<T, P> type;
|
||||
typedef tmat3x4<T, P> transpose_type;
|
||||
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const;
|
||||
typedef T value_type;
|
||||
|
||||
private:
|
||||
// Data
|
||||
@ -58,14 +57,11 @@ namespace detail
|
||||
public:
|
||||
// Constructors
|
||||
GLM_FUNC_DECL tmat4x3();
|
||||
GLM_FUNC_DECL tmat4x3(tmat4x3<T, P> const & m);
|
||||
template <precision Q>
|
||||
GLM_FUNC_DECL tmat4x3(tmat4x3<T, Q> const & m);
|
||||
|
||||
GLM_FUNC_DECL explicit tmat4x3(
|
||||
ctor Null);
|
||||
GLM_FUNC_DECL explicit tmat4x3(
|
||||
T const & x);
|
||||
GLM_FUNC_DECL explicit tmat4x3(ctor);
|
||||
GLM_FUNC_DECL explicit tmat4x3(T const & x);
|
||||
GLM_FUNC_DECL tmat4x3(
|
||||
T const & x0, T const & y0, T const & z0,
|
||||
T const & x1, T const & y1, T const & z1,
|
||||
@ -98,10 +94,17 @@ namespace detail
|
||||
tvec3<V3, P> const & v3,
|
||||
tvec3<V4, P> const & v4);
|
||||
|
||||
//////////////////////////////////////
|
||||
// Matrix conversions
|
||||
template <typename U, precision Q>
|
||||
GLM_FUNC_DECL explicit tmat4x3(tmat4x3<U, Q> const & m);
|
||||
|
||||
|
||||
# ifdef GLM_FORCE_EXPLICIT_CTOR
|
||||
template <typename U, precision Q>
|
||||
GLM_FUNC_DECL explicit tmat4x3(tmat4x3<U, Q> const & m);
|
||||
# else
|
||||
template <typename U, precision Q>
|
||||
GLM_FUNC_DECL tmat4x3(tmat4x3<U, Q> const & m);
|
||||
# endif
|
||||
|
||||
GLM_FUNC_DECL explicit tmat4x3(tmat2x2<T, P> const & x);
|
||||
GLM_FUNC_DECL explicit tmat4x3(tmat3x3<T, P> const & x);
|
||||
GLM_FUNC_DECL explicit tmat4x3(tmat4x4<T, P> const & x);
|
||||
@ -111,112 +114,95 @@ namespace detail
|
||||
GLM_FUNC_DECL explicit tmat4x3(tmat4x2<T, P> const & x);
|
||||
GLM_FUNC_DECL explicit tmat4x3(tmat3x4<T, P> const & x);
|
||||
|
||||
//////////////////////////////////////
|
||||
// Accesses
|
||||
GLM_FUNC_DECL col_type & operator[](size_type i);
|
||||
GLM_FUNC_DECL col_type const & operator[](size_type i) const;
|
||||
|
||||
// Unary updatable operators
|
||||
GLM_FUNC_DECL tmat4x3<T, P> & operator= (tmat4x3<T, P> const & m);
|
||||
# ifdef GLM_FORCE_SIZE_FUNC
|
||||
typedef size_t size_type;
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR size_t size() const;
|
||||
|
||||
GLM_FUNC_DECL col_type & operator[](size_type i);
|
||||
GLM_FUNC_DECL col_type const & operator[](size_type i) const;
|
||||
# else
|
||||
typedef length_t length_type;
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR length_type length() const;
|
||||
|
||||
GLM_FUNC_DECL col_type & operator[](length_type i);
|
||||
GLM_FUNC_DECL col_type const & operator[](length_type i) const;
|
||||
# endif//GLM_FORCE_SIZE_FUNC
|
||||
|
||||
//////////////////////////////////////
|
||||
// Unary arithmetic operators
|
||||
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tmat4x3<T, P> & operator= (tmat4x3<U, P> const & m);
|
||||
GLM_FUNC_DECL tmat4x3<T, P> & operator=(tmat4x3<U, P> const & m);
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tmat4x3<T, P> & operator+= (U s);
|
||||
GLM_FUNC_DECL tmat4x3<T, P> & operator+=(U s);
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tmat4x3<T, P> & operator+= (tmat4x3<U, P> const & m);
|
||||
GLM_FUNC_DECL tmat4x3<T, P> & operator+=(tmat4x3<U, P> const & m);
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tmat4x3<T, P> & operator-= (U s);
|
||||
GLM_FUNC_DECL tmat4x3<T, P> & operator-=(U s);
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tmat4x3<T, P> & operator-= (tmat4x3<U, P> const & m);
|
||||
GLM_FUNC_DECL tmat4x3<T, P> & operator-=(tmat4x3<U, P> const & m);
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tmat4x3<T, P> & operator*= (U s);
|
||||
GLM_FUNC_DECL tmat4x3<T, P> & operator*=(U s);
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tmat4x3<T, P> & operator/= (U s);
|
||||
GLM_FUNC_DECL tmat4x3<T, P> & operator/=(U s);
|
||||
|
||||
//////////////////////////////////////
|
||||
// Increment and decrement operators
|
||||
|
||||
GLM_FUNC_DECL tmat4x3<T, P> & operator++ ();
|
||||
GLM_FUNC_DECL tmat4x3<T, P> & operator-- ();
|
||||
GLM_FUNC_DECL tmat4x3<T, P> & operator++();
|
||||
GLM_FUNC_DECL tmat4x3<T, P> & operator--();
|
||||
GLM_FUNC_DECL tmat4x3<T, P> operator++(int);
|
||||
GLM_FUNC_DECL tmat4x3<T, P> operator--(int);
|
||||
};
|
||||
|
||||
// Binary operators
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tmat4x3<T, P> operator+ (
|
||||
tmat4x3<T, P> const & m,
|
||||
T const & s);
|
||||
GLM_FUNC_DECL tmat4x3<T, P> operator+(tmat4x3<T, P> const & m, T const & s);
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tmat4x3<T, P> operator+ (
|
||||
tmat4x3<T, P> const & m1,
|
||||
tmat4x3<T, P> const & m2);
|
||||
GLM_FUNC_DECL tmat4x3<T, P> operator+(tmat4x3<T, P> const & m1, tmat4x3<T, P> const & m2);
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tmat4x3<T, P> operator- (
|
||||
tmat4x3<T, P> const & m,
|
||||
T const & s);
|
||||
GLM_FUNC_DECL tmat4x3<T, P> operator-(tmat4x3<T, P> const & m, T const & s);
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tmat4x3<T, P> operator- (
|
||||
tmat4x3<T, P> const & m1,
|
||||
tmat4x3<T, P> const & m2);
|
||||
GLM_FUNC_DECL tmat4x3<T, P> operator-(tmat4x3<T, P> const & m1, tmat4x3<T, P> const & m2);
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tmat4x3<T, P> operator* (
|
||||
tmat4x3<T, P> const & m,
|
||||
T const & s);
|
||||
GLM_FUNC_DECL tmat4x3<T, P> operator*(tmat4x3<T, P> const & m, T const & s);
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tmat4x3<T, P> operator* (
|
||||
T const & s,
|
||||
tmat4x3<T, P> const & m);
|
||||
GLM_FUNC_DECL tmat4x3<T, P> operator*(T const & s, tmat4x3<T, P> const & m);
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL typename tmat4x3<T, P>::col_type operator* (
|
||||
tmat4x3<T, P> const & m,
|
||||
typename tmat4x3<T, P>::row_type const & v);
|
||||
GLM_FUNC_DECL typename tmat4x3<T, P>::col_type operator*(tmat4x3<T, P> const & m, typename tmat4x3<T, P>::row_type const & v);
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL typename tmat4x3<T, P>::row_type operator* (
|
||||
typename tmat4x3<T, P>::col_type const & v,
|
||||
tmat4x3<T, P> const & m);
|
||||
GLM_FUNC_DECL typename tmat4x3<T, P>::row_type operator*(typename tmat4x3<T, P>::col_type const & v, tmat4x3<T, P> const & m);
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tmat2x3<T, P> operator* (
|
||||
tmat4x3<T, P> const & m1,
|
||||
tmat2x4<T, P> const & m2);
|
||||
GLM_FUNC_DECL tmat2x3<T, P> operator*(tmat4x3<T, P> const & m1, tmat2x4<T, P> const & m2);
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tmat3x3<T, P> operator* (
|
||||
tmat4x3<T, P> const & m1,
|
||||
tmat3x4<T, P> const & m2);
|
||||
GLM_FUNC_DECL tmat3x3<T, P> operator*(tmat4x3<T, P> const & m1, tmat3x4<T, P> const & m2);
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tmat4x3<T, P> operator* (
|
||||
tmat4x3<T, P> const & m1,
|
||||
tmat4x4<T, P> const & m2);
|
||||
GLM_FUNC_DECL tmat4x3<T, P> operator*(tmat4x3<T, P> const & m1, tmat4x4<T, P> const & m2);
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tmat4x3<T, P> operator/ (
|
||||
tmat4x3<T, P> const & m,
|
||||
T const & s);
|
||||
GLM_FUNC_DECL tmat4x3<T, P> operator/(tmat4x3<T, P> const & m, T const & s);
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tmat4x3<T, P> operator/ (
|
||||
T const & s,
|
||||
tmat4x3<T, P> const & m);
|
||||
GLM_FUNC_DECL tmat4x3<T, P> operator/(T const & s, tmat4x3<T, P> const & m);
|
||||
|
||||
// Unary constant operators
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tmat4x3<T, P> const operator- (
|
||||
tmat4x3<T, P> const & m);
|
||||
|
||||
}//namespace detail
|
||||
GLM_FUNC_DECL tmat4x3<T, P> const operator-(tmat4x3<T, P> const & m);
|
||||
}//namespace glm
|
||||
|
||||
#ifndef GLM_EXTERNAL_TEMPLATE
|
||||
#include "type_mat4x3.inl"
|
||||
#endif //GLM_EXTERNAL_TEMPLATE
|
||||
|
||||
#endif//glm_core_type_mat4x3
|
||||
|
||||
@ -12,6 +12,10 @@
|
||||
/// 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
|
||||
@ -21,73 +25,30 @@
|
||||
/// THE SOFTWARE.
|
||||
///
|
||||
/// @ref core
|
||||
/// @file glm/core/type_mat4x3.inl
|
||||
/// @file glm/detail/type_mat4x3.inl
|
||||
/// @date 2006-04-17 / 2011-06-15
|
||||
/// @author Christophe Riccio
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
namespace glm{
|
||||
namespace detail
|
||||
namespace glm
|
||||
{
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR length_t tmat4x3<T, P>::length() const
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
|
||||
//////////////////////////////////////
|
||||
// Accesses
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER typename tmat4x3<T, P>::col_type &
|
||||
tmat4x3<T, P>::operator[]
|
||||
(
|
||||
size_type i
|
||||
)
|
||||
{
|
||||
assert(i < this->length());
|
||||
return this->value[i];
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER typename tmat4x3<T, P>::col_type const &
|
||||
tmat4x3<T, P>::operator[]
|
||||
(
|
||||
size_type i
|
||||
) const
|
||||
{
|
||||
assert(i < this->length());
|
||||
return this->value[i];
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
// Constructors
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat4x3<T, P>::tmat4x3()
|
||||
{
|
||||
value_type const Zero(0);
|
||||
value_type const One(1);
|
||||
this->value[0] = col_type(One, Zero, Zero);
|
||||
this->value[1] = col_type(Zero, One, Zero);
|
||||
this->value[2] = col_type(Zero, Zero, One);
|
||||
this->value[3] = col_type(Zero, Zero, Zero);
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat4x3<T, P>::tmat4x3(
|
||||
tmat4x3<T, P> const & m)
|
||||
{
|
||||
this->value[0] = m.value[0];
|
||||
this->value[1] = m.value[1];
|
||||
this->value[2] = m.value[2];
|
||||
this->value[3] = m.value[3];
|
||||
# ifndef GLM_FORCE_NO_CTOR_INIT
|
||||
this->value[0] = col_type(1, 0, 0);
|
||||
this->value[1] = col_type(0, 1, 0);
|
||||
this->value[2] = col_type(0, 0, 1);
|
||||
this->value[3] = col_type(0, 0, 0);
|
||||
# endif
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
template <precision Q>
|
||||
GLM_FUNC_QUALIFIER tmat4x3<T, P>::tmat4x3(
|
||||
tmat4x3<T, Q> const & m)
|
||||
GLM_FUNC_QUALIFIER tmat4x3<T, P>::tmat4x3(tmat4x3<T, Q> const & m)
|
||||
{
|
||||
this->value[0] = m.value[0];
|
||||
this->value[1] = m.value[1];
|
||||
@ -100,14 +61,12 @@ namespace detail
|
||||
{}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat4x3<T, P>::tmat4x3(
|
||||
T const & s)
|
||||
GLM_FUNC_QUALIFIER tmat4x3<T, P>::tmat4x3(T const & s)
|
||||
{
|
||||
value_type const Zero(0);
|
||||
this->value[0] = col_type(s, Zero, Zero);
|
||||
this->value[1] = col_type(Zero, s, Zero);
|
||||
this->value[2] = col_type(Zero, Zero, s);
|
||||
this->value[3] = col_type(Zero, Zero, Zero);
|
||||
this->value[0] = col_type(s, 0, 0);
|
||||
this->value[1] = col_type(0, s, 0);
|
||||
this->value[2] = col_type(0, 0, s);
|
||||
this->value[3] = col_type(0, 0, 0);
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
@ -184,10 +143,7 @@ namespace detail
|
||||
|
||||
template <typename T, precision P>
|
||||
template <typename U, precision Q>
|
||||
GLM_FUNC_QUALIFIER tmat4x3<T, P>::tmat4x3
|
||||
(
|
||||
tmat4x3<U, Q> const & m
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat4x3<T, P>::tmat4x3(tmat4x3<U, Q> const & m)
|
||||
{
|
||||
this->value[0] = col_type(m[0]);
|
||||
this->value[1] = col_type(m[1]);
|
||||
@ -196,34 +152,25 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat4x3<T, P>::tmat4x3
|
||||
(
|
||||
tmat2x2<T, P> const & m
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat4x3<T, P>::tmat4x3(tmat2x2<T, P> const & m)
|
||||
{
|
||||
this->value[0] = col_type(m[0], value_type(0));
|
||||
this->value[1] = col_type(m[1], value_type(0));
|
||||
this->value[2] = col_type(m[2], value_type(1));
|
||||
this->value[3] = col_type(static_cast<T>(0));
|
||||
this->value[0] = col_type(m[0], 0);
|
||||
this->value[1] = col_type(m[1], 0);
|
||||
this->value[2] = col_type(m[2], 1);
|
||||
this->value[3] = col_type(0);
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat4x3<T, P>::tmat4x3
|
||||
(
|
||||
tmat3x3<T, P> const & m
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat4x3<T, P>::tmat4x3(tmat3x3<T, P> const & m)
|
||||
{
|
||||
this->value[0] = col_type(m[0]);
|
||||
this->value[1] = col_type(m[1]);
|
||||
this->value[2] = col_type(m[2]);
|
||||
this->value[3] = col_type(static_cast<T>(0));
|
||||
this->value[3] = col_type(0);
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat4x3<T, P>::tmat4x3
|
||||
(
|
||||
tmat4x4<T, P> const & m
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat4x3<T, P>::tmat4x3(tmat4x4<T, P> const & m)
|
||||
{
|
||||
this->value[0] = col_type(m[0]);
|
||||
this->value[1] = col_type(m[1]);
|
||||
@ -232,73 +179,101 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat4x3<T, P>::tmat4x3
|
||||
(
|
||||
tmat2x3<T, P> const & m
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat4x3<T, P>::tmat4x3(tmat2x3<T, P> const & m)
|
||||
{
|
||||
this->value[0] = col_type(m[0]);
|
||||
this->value[1] = col_type(m[1]);
|
||||
this->value[2] = col_type(static_cast<T>(0), value_type(0), value_type(1));
|
||||
this->value[3] = col_type(static_cast<T>(0));
|
||||
this->value[2] = col_type(0, 0, 1);
|
||||
this->value[3] = col_type(0);
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat4x3<T, P>::tmat4x3
|
||||
(
|
||||
tmat3x2<T, P> const & m
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat4x3<T, P>::tmat4x3(tmat3x2<T, P> const & m)
|
||||
{
|
||||
this->value[0] = col_type(m[0], value_type(0));
|
||||
this->value[1] = col_type(m[1], value_type(0));
|
||||
this->value[2] = col_type(m[2], value_type(1));
|
||||
this->value[3] = col_type(static_cast<T>(0));
|
||||
this->value[0] = col_type(m[0], 0);
|
||||
this->value[1] = col_type(m[1], 0);
|
||||
this->value[2] = col_type(m[2], 1);
|
||||
this->value[3] = col_type(0);
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat4x3<T, P>::tmat4x3
|
||||
(
|
||||
tmat2x4<T, P> const & m
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat4x3<T, P>::tmat4x3(tmat2x4<T, P> const & m)
|
||||
{
|
||||
this->value[0] = col_type(m[0]);
|
||||
this->value[1] = col_type(m[1]);
|
||||
this->value[2] = col_type(static_cast<T>(0), value_type(0), value_type(1));
|
||||
this->value[3] = col_type(static_cast<T>(0));
|
||||
this->value[2] = col_type(0, 0, 1);
|
||||
this->value[3] = col_type(0);
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat4x3<T, P>::tmat4x3
|
||||
(
|
||||
tmat4x2<T, P> const & m
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat4x3<T, P>::tmat4x3(tmat4x2<T, P> const & m)
|
||||
{
|
||||
this->value[0] = col_type(m[0], value_type(0));
|
||||
this->value[1] = col_type(m[1], value_type(0));
|
||||
this->value[2] = col_type(m[2], value_type(1));
|
||||
this->value[3] = col_type(m[3], value_type(0));
|
||||
this->value[0] = col_type(m[0], 0);
|
||||
this->value[1] = col_type(m[1], 0);
|
||||
this->value[2] = col_type(m[2], 1);
|
||||
this->value[3] = col_type(m[3], 0);
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat4x3<T, P>::tmat4x3
|
||||
(
|
||||
tmat3x4<T, P> const & m
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat4x3<T, P>::tmat4x3(tmat3x4<T, P> const & m)
|
||||
{
|
||||
this->value[0] = col_type(m[0]);
|
||||
this->value[1] = col_type(m[1]);
|
||||
this->value[2] = col_type(m[2]);
|
||||
this->value[3] = col_type(static_cast<T>(0));
|
||||
this->value[3] = col_type(0);
|
||||
}
|
||||
|
||||
//////////////////////////////////////
|
||||
// Accesses
|
||||
|
||||
# ifdef GLM_FORCE_SIZE_FUNC
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tmat4x3<T, P>::size_type tmat4x3<T, P>::size() const
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER typename tmat4x3<T, P>::col_type & tmat4x3<T, P>::operator[](typename tmat4x3<T, P>::size_type i)
|
||||
{
|
||||
assert(i < this->size());
|
||||
return this->value[i];
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER typename tmat4x3<T, P>::col_type const & tmat4x3<T, P>::operator[](typename tmat4x3<T, P>::size_type i) const
|
||||
{
|
||||
assert(i < this->size());
|
||||
return this->value[i];
|
||||
}
|
||||
# else
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tmat4x3<T, P>::length_type tmat4x3<T, P>::length() const
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER typename tmat4x3<T, P>::col_type & tmat4x3<T, P>::operator[](typename tmat4x3<T, P>::length_type i)
|
||||
{
|
||||
assert(i < this->length());
|
||||
return this->value[i];
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER typename tmat4x3<T, P>::col_type const & tmat4x3<T, P>::operator[](typename tmat4x3<T, P>::length_type i) const
|
||||
{
|
||||
assert(i < this->length());
|
||||
return this->value[i];
|
||||
}
|
||||
# endif//GLM_FORCE_SIZE_FUNC
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
// Unary updatable operators
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat4x3<T, P>& tmat4x3<T, P>::operator=
|
||||
(
|
||||
tmat4x3<T, P> const & m
|
||||
)
|
||||
template <typename U>
|
||||
GLM_FUNC_QUALIFIER tmat4x3<T, P>& tmat4x3<T, P>::operator=(tmat4x3<U, P> const & m)
|
||||
{
|
||||
this->value[0] = m[0];
|
||||
this->value[1] = m[1];
|
||||
@ -309,21 +284,7 @@ namespace detail
|
||||
|
||||
template <typename T, precision P>
|
||||
template <typename U>
|
||||
GLM_FUNC_QUALIFIER tmat4x3<T, P>& tmat4x3<T, P>::operator=
|
||||
(
|
||||
tmat4x3<U, P> const & m
|
||||
)
|
||||
{
|
||||
this->value[0] = m[0];
|
||||
this->value[1] = m[1];
|
||||
this->value[2] = m[2];
|
||||
this->value[3] = m[3];
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
template <typename U>
|
||||
GLM_FUNC_QUALIFIER tmat4x3<T, P> & tmat4x3<T, P>::operator+= (U s)
|
||||
GLM_FUNC_QUALIFIER tmat4x3<T, P> & tmat4x3<T, P>::operator+=(U s)
|
||||
{
|
||||
this->value[0] += s;
|
||||
this->value[1] += s;
|
||||
@ -334,7 +295,7 @@ namespace detail
|
||||
|
||||
template <typename T, precision P>
|
||||
template <typename U>
|
||||
GLM_FUNC_QUALIFIER tmat4x3<T, P> & tmat4x3<T, P>::operator+= (tmat4x3<U, P> const & m)
|
||||
GLM_FUNC_QUALIFIER tmat4x3<T, P> & tmat4x3<T, P>::operator+=(tmat4x3<U, P> const & m)
|
||||
{
|
||||
this->value[0] += m[0];
|
||||
this->value[1] += m[1];
|
||||
@ -345,7 +306,7 @@ namespace detail
|
||||
|
||||
template <typename T, precision P>
|
||||
template <typename U>
|
||||
GLM_FUNC_QUALIFIER tmat4x3<T, P> & tmat4x3<T, P>::operator-= (U s)
|
||||
GLM_FUNC_QUALIFIER tmat4x3<T, P> & tmat4x3<T, P>::operator-=(U s)
|
||||
{
|
||||
this->value[0] -= s;
|
||||
this->value[1] -= s;
|
||||
@ -356,7 +317,7 @@ namespace detail
|
||||
|
||||
template <typename T, precision P>
|
||||
template <typename U>
|
||||
GLM_FUNC_QUALIFIER tmat4x3<T, P> & tmat4x3<T, P>::operator-= (tmat4x3<U, P> const & m)
|
||||
GLM_FUNC_QUALIFIER tmat4x3<T, P> & tmat4x3<T, P>::operator-=(tmat4x3<U, P> const & m)
|
||||
{
|
||||
this->value[0] -= m[0];
|
||||
this->value[1] -= m[1];
|
||||
@ -367,7 +328,7 @@ namespace detail
|
||||
|
||||
template <typename T, precision P>
|
||||
template <typename U>
|
||||
GLM_FUNC_QUALIFIER tmat4x3<T, P> & tmat4x3<T, P>::operator*= (U s)
|
||||
GLM_FUNC_QUALIFIER tmat4x3<T, P> & tmat4x3<T, P>::operator*=(U s)
|
||||
{
|
||||
this->value[0] *= s;
|
||||
this->value[1] *= s;
|
||||
@ -378,7 +339,7 @@ namespace detail
|
||||
|
||||
template <typename T, precision P>
|
||||
template <typename U>
|
||||
GLM_FUNC_QUALIFIER tmat4x3<T, P> & tmat4x3<T, P>::operator/= (U s)
|
||||
GLM_FUNC_QUALIFIER tmat4x3<T, P> & tmat4x3<T, P>::operator/=(U s)
|
||||
{
|
||||
this->value[0] /= s;
|
||||
this->value[1] /= s;
|
||||
@ -388,7 +349,7 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat4x3<T, P> & tmat4x3<T, P>::operator++ ()
|
||||
GLM_FUNC_QUALIFIER tmat4x3<T, P> & tmat4x3<T, P>::operator++()
|
||||
{
|
||||
++this->value[0];
|
||||
++this->value[1];
|
||||
@ -398,7 +359,7 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat4x3<T, P> & tmat4x3<T, P>::operator-- ()
|
||||
GLM_FUNC_QUALIFIER tmat4x3<T, P> & tmat4x3<T, P>::operator--()
|
||||
{
|
||||
--this->value[0];
|
||||
--this->value[1];
|
||||
@ -411,9 +372,7 @@ namespace detail
|
||||
// Binary operators
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat4x3<T, P> operator+ (
|
||||
tmat4x3<T, P> const & m,
|
||||
T const & s)
|
||||
GLM_FUNC_QUALIFIER tmat4x3<T, P> operator+(tmat4x3<T, P> const & m, T const & s)
|
||||
{
|
||||
return tmat4x3<T, P>(
|
||||
m[0] + s,
|
||||
@ -423,9 +382,7 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat4x3<T, P> operator+ (
|
||||
tmat4x3<T, P> const & m1,
|
||||
tmat4x3<T, P> const & m2)
|
||||
GLM_FUNC_QUALIFIER tmat4x3<T, P> operator+(tmat4x3<T, P> const & m1, tmat4x3<T, P> const & m2)
|
||||
{
|
||||
return tmat4x3<T, P>(
|
||||
m1[0] + m2[0],
|
||||
@ -435,9 +392,7 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat4x3<T, P> operator- (
|
||||
tmat4x3<T, P> const & m,
|
||||
T const & s)
|
||||
GLM_FUNC_QUALIFIER tmat4x3<T, P> operator-(tmat4x3<T, P> const & m, T const & s)
|
||||
{
|
||||
return tmat4x3<T, P>(
|
||||
m[0] - s,
|
||||
@ -447,9 +402,7 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat4x3<T, P> operator- (
|
||||
tmat4x3<T, P> const & m1,
|
||||
tmat4x3<T, P> const & m2)
|
||||
GLM_FUNC_QUALIFIER tmat4x3<T, P> operator-(tmat4x3<T, P> const & m1, tmat4x3<T, P> const & m2)
|
||||
{
|
||||
return tmat4x3<T, P>(
|
||||
m1[0] - m2[0],
|
||||
@ -459,9 +412,7 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat4x3<T, P> operator* (
|
||||
tmat4x3<T, P> const & m,
|
||||
T const & s)
|
||||
GLM_FUNC_QUALIFIER tmat4x3<T, P> operator*(tmat4x3<T, P> const & m, T const & s)
|
||||
{
|
||||
return tmat4x3<T, P>(
|
||||
m[0] * s,
|
||||
@ -471,9 +422,7 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat4x3<T, P> operator* (
|
||||
T const & s,
|
||||
tmat4x3<T, P> const & m)
|
||||
GLM_FUNC_QUALIFIER tmat4x3<T, P> operator*(T const & s, tmat4x3<T, P> const & m)
|
||||
{
|
||||
return tmat4x3<T, P>(
|
||||
m[0] * s,
|
||||
@ -508,11 +457,7 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat2x3<T, P> operator*
|
||||
(
|
||||
tmat4x3<T, P> const & m1,
|
||||
tmat2x4<T, P> const & m2
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat2x3<T, P> operator*(tmat4x3<T, P> const & m1, tmat2x4<T, P> const & m2)
|
||||
{
|
||||
return tmat2x3<T, P>(
|
||||
m1[0][0] * m2[0][0] + m1[1][0] * m2[0][1] + m1[2][0] * m2[0][2] + m1[3][0] * m2[0][3],
|
||||
@ -524,11 +469,7 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat3x3<T, P> operator*
|
||||
(
|
||||
tmat4x3<T, P> const & m1,
|
||||
tmat3x4<T, P> const & m2
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat3x3<T, P> operator*(tmat4x3<T, P> const & m1, tmat3x4<T, P> const & m2)
|
||||
{
|
||||
T const SrcA00 = m1[0][0];
|
||||
T const SrcA01 = m1[0][1];
|
||||
@ -556,7 +497,7 @@ namespace detail
|
||||
T const SrcB22 = m2[2][2];
|
||||
T const SrcB23 = m2[2][3];
|
||||
|
||||
tmat3x3<T, P> Result(tmat3x3<T, P>::_null);
|
||||
tmat3x3<T, P> Result(uninitialize);
|
||||
Result[0][0] = SrcA00 * SrcB00 + SrcA10 * SrcB01 + SrcA20 * SrcB02 + SrcA30 * SrcB03;
|
||||
Result[0][1] = SrcA01 * SrcB00 + SrcA11 * SrcB01 + SrcA21 * SrcB02 + SrcA31 * SrcB03;
|
||||
Result[0][2] = SrcA02 * SrcB00 + SrcA12 * SrcB01 + SrcA22 * SrcB02 + SrcA32 * SrcB03;
|
||||
@ -570,11 +511,7 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat4x3<T, P> operator*
|
||||
(
|
||||
tmat4x3<T, P> const & m1,
|
||||
tmat4x4<T, P> const & m2
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat4x3<T, P> operator*(tmat4x3<T, P> const & m1, tmat4x4<T, P> const & m2)
|
||||
{
|
||||
return tmat4x3<T, P>(
|
||||
m1[0][0] * m2[0][0] + m1[1][0] * m2[0][1] + m1[2][0] * m2[0][2] + m1[3][0] * m2[0][3],
|
||||
@ -592,11 +529,7 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat4x3<T, P> operator/
|
||||
(
|
||||
tmat4x3<T, P> const & m,
|
||||
T const & s
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat4x3<T, P> operator/(tmat4x3<T, P> const & m, T const & s)
|
||||
{
|
||||
return tmat4x3<T, P>(
|
||||
m[0] / s,
|
||||
@ -606,11 +539,7 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat4x3<T, P> operator/
|
||||
(
|
||||
T const & s,
|
||||
tmat4x3<T, P> const & m
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat4x3<T, P> operator/(T const & s, tmat4x3<T, P> const & m)
|
||||
{
|
||||
return tmat4x3<T, P>(
|
||||
s / m[0],
|
||||
@ -621,10 +550,7 @@ namespace detail
|
||||
|
||||
// Unary constant operators
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat4x3<T, P> const operator-
|
||||
(
|
||||
tmat4x3<T, P> const & m
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat4x3<T, P> const operator-(tmat4x3<T, P> const & m)
|
||||
{
|
||||
return tmat4x3<T, P>(
|
||||
-m[0],
|
||||
@ -634,11 +560,7 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat4x3<T, P> const operator++
|
||||
(
|
||||
tmat4x3<T, P> const & m,
|
||||
int
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat4x3<T, P> const operator++(tmat4x3<T, P> const & m, int)
|
||||
{
|
||||
return tmat4x3<T, P>(
|
||||
m[0] + T(1),
|
||||
@ -648,11 +570,7 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat4x3<T, P> const operator--
|
||||
(
|
||||
tmat4x3<T, P> const & m,
|
||||
int
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat4x3<T, P> const operator--(tmat4x3<T, P> const & m, int)
|
||||
{
|
||||
return tmat4x3<T, P>(
|
||||
m[0] - T(1),
|
||||
@ -681,24 +599,14 @@ namespace detail
|
||||
// Boolean operators
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER bool operator==
|
||||
(
|
||||
tmat4x3<T, P> const & m1,
|
||||
tmat4x3<T, P> const & m2
|
||||
)
|
||||
GLM_FUNC_QUALIFIER bool operator==(tmat4x3<T, P> const & m1, tmat4x3<T, P> const & m2)
|
||||
{
|
||||
return (m1[0] == m2[0]) && (m1[1] == m2[1]) && (m1[2] == m2[2]) && (m1[3] == m2[3]);
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER bool operator!=
|
||||
(
|
||||
tmat4x3<T, P> const & m1,
|
||||
tmat4x3<T, P> const & m2
|
||||
)
|
||||
GLM_FUNC_QUALIFIER bool operator!=(tmat4x3<T, P> const & m1, tmat4x3<T, P> const & m2)
|
||||
{
|
||||
return (m1[0] != m2[0]) || (m1[1] != m2[1]) || (m1[2] != m2[2]) || (m1[3] != m2[3]);
|
||||
}
|
||||
} //namespace detail
|
||||
} //namespace glm
|
||||
|
||||
|
||||
@ -12,6 +12,10 @@
|
||||
/// 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
|
||||
@ -21,13 +25,12 @@
|
||||
/// THE SOFTWARE.
|
||||
///
|
||||
/// @ref core
|
||||
/// @file glm/core/type_mat4x4.hpp
|
||||
/// @file glm/detail/type_mat4x4.hpp
|
||||
/// @date 2005-01-27 / 2011-06-15
|
||||
/// @author Christophe Riccio
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef glm_core_type_mat4x4
|
||||
#define glm_core_type_mat4x4
|
||||
#pragma once
|
||||
|
||||
#include "../fwd.hpp"
|
||||
#include "type_vec4.hpp"
|
||||
@ -35,21 +38,16 @@
|
||||
#include <limits>
|
||||
#include <cstddef>
|
||||
|
||||
namespace glm{
|
||||
namespace detail
|
||||
namespace glm
|
||||
{
|
||||
template <typename T, precision P>
|
||||
template <typename T, precision P = defaultp>
|
||||
struct tmat4x4
|
||||
{
|
||||
enum ctor{_null};
|
||||
typedef T value_type;
|
||||
typedef std::size_t size_type;
|
||||
typedef tvec4<T, P> col_type;
|
||||
typedef tvec4<T, P> row_type;
|
||||
typedef tmat4x4<T, P> type;
|
||||
typedef tmat4x4<T, P> transpose_type;
|
||||
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const;
|
||||
typedef T value_type;
|
||||
|
||||
template <typename U, precision Q>
|
||||
friend tvec4<U, Q> operator/(tmat4x4<U, Q> const & m, tvec4<U, Q> const & v);
|
||||
@ -59,18 +57,16 @@ namespace detail
|
||||
private:
|
||||
/// @cond DETAIL
|
||||
col_type value[4];
|
||||
/// @endcond
|
||||
|
||||
public:
|
||||
// Constructors
|
||||
GLM_FUNC_DECL tmat4x4();
|
||||
GLM_FUNC_DECL tmat4x4(tmat4x4<T, P> const & m);
|
||||
template <precision Q>
|
||||
GLM_FUNC_DECL tmat4x4(tmat4x4<T, Q> const & m);
|
||||
|
||||
GLM_FUNC_DECL explicit tmat4x4(
|
||||
ctor Null);
|
||||
GLM_FUNC_DECL explicit tmat4x4(
|
||||
T const & x);
|
||||
GLM_FUNC_DECL explicit tmat4x4(ctor);
|
||||
GLM_FUNC_DECL explicit tmat4x4(T const & x);
|
||||
GLM_FUNC_DECL tmat4x4(
|
||||
T const & x0, T const & y0, T const & z0, T const & w0,
|
||||
T const & x1, T const & y1, T const & z1, T const & w1,
|
||||
@ -95,17 +91,24 @@ namespace detail
|
||||
X2 const & x2, Y2 const & y2, Z2 const & z2, W2 const & w2,
|
||||
X3 const & x3, Y3 const & y3, Z3 const & z3, W3 const & w3,
|
||||
X4 const & x4, Y4 const & y4, Z4 const & z4, W4 const & w4);
|
||||
|
||||
|
||||
template <typename V1, typename V2, typename V3, typename V4>
|
||||
GLM_FUNC_DECL tmat4x4(
|
||||
tvec4<V1, P> const & v1,
|
||||
tvec4<V2, P> const & v2,
|
||||
tvec4<V3, P> const & v3,
|
||||
tvec4<V4, P> const & v4);
|
||||
|
||||
|
||||
//////////////////////////////////////
|
||||
// Matrix conversions
|
||||
template <typename U, precision Q>
|
||||
GLM_FUNC_DECL explicit tmat4x4(tmat4x4<U, Q> const & m);
|
||||
|
||||
# ifdef GLM_FORCE_EXPLICIT_CTOR
|
||||
template <typename U, precision Q>
|
||||
GLM_FUNC_DECL explicit tmat4x4(tmat4x4<U, Q> const & m);
|
||||
# else
|
||||
template <typename U, precision Q>
|
||||
GLM_FUNC_DECL tmat4x4(tmat4x4<U, Q> const & m);
|
||||
# endif
|
||||
|
||||
GLM_FUNC_DECL explicit tmat4x4(tmat2x2<T, P> const & x);
|
||||
GLM_FUNC_DECL explicit tmat4x4(tmat3x3<T, P> const & x);
|
||||
@ -116,144 +119,114 @@ namespace detail
|
||||
GLM_FUNC_DECL explicit tmat4x4(tmat3x4<T, P> const & x);
|
||||
GLM_FUNC_DECL explicit tmat4x4(tmat4x3<T, P> const & x);
|
||||
|
||||
//////////////////////////////////////
|
||||
// Accesses
|
||||
GLM_FUNC_DECL col_type & operator[](length_t i);
|
||||
GLM_FUNC_DECL col_type const & operator[](length_t i) const;
|
||||
|
||||
// Unary updatable operators
|
||||
GLM_FUNC_DECL tmat4x4<T, P> & operator= (tmat4x4<T, P> const & m);
|
||||
# ifdef GLM_FORCE_SIZE_FUNC
|
||||
typedef size_t size_type;
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR size_t size() const;
|
||||
|
||||
GLM_FUNC_DECL col_type & operator[](size_type i);
|
||||
GLM_FUNC_DECL col_type const & operator[](size_type i) const;
|
||||
# else
|
||||
typedef length_t length_type;
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR length_type length() const;
|
||||
|
||||
GLM_FUNC_DECL col_type & operator[](length_type i);
|
||||
GLM_FUNC_DECL col_type const & operator[](length_type i) const;
|
||||
# endif//GLM_FORCE_SIZE_FUNC
|
||||
|
||||
//////////////////////////////////////
|
||||
// Unary arithmetic operators
|
||||
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tmat4x4<T, P> & operator= (tmat4x4<U, P> const & m);
|
||||
GLM_FUNC_DECL tmat4x4<T, P> & operator=(tmat4x4<U, P> const & m);
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tmat4x4<T, P> & operator+= (U s);
|
||||
GLM_FUNC_DECL tmat4x4<T, P> & operator+=(U s);
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tmat4x4<T, P> & operator+= (tmat4x4<U, P> const & m);
|
||||
GLM_FUNC_DECL tmat4x4<T, P> & operator+=(tmat4x4<U, P> const & m);
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tmat4x4<T, P> & operator-= (U s);
|
||||
GLM_FUNC_DECL tmat4x4<T, P> & operator-=(U s);
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tmat4x4<T, P> & operator-= (tmat4x4<U, P> const & m);
|
||||
GLM_FUNC_DECL tmat4x4<T, P> & operator-=(tmat4x4<U, P> const & m);
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tmat4x4<T, P> & operator*= (U s);
|
||||
GLM_FUNC_DECL tmat4x4<T, P> & operator*=(U s);
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tmat4x4<T, P> & operator*= (tmat4x4<U, P> const & m);
|
||||
GLM_FUNC_DECL tmat4x4<T, P> & operator*=(tmat4x4<U, P> const & m);
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tmat4x4<T, P> & operator/= (U s);
|
||||
GLM_FUNC_DECL tmat4x4<T, P> & operator/=(U s);
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tmat4x4<T, P> & operator/= (tmat4x4<U, P> const & m);
|
||||
GLM_FUNC_DECL tmat4x4<T, P> & operator/=(tmat4x4<U, P> const & m);
|
||||
|
||||
//////////////////////////////////////
|
||||
// Increment and decrement operators
|
||||
|
||||
GLM_FUNC_DECL tmat4x4<T, P> & operator++ ();
|
||||
GLM_FUNC_DECL tmat4x4<T, P> & operator-- ();
|
||||
GLM_FUNC_DECL tmat4x4<T, P> & operator++();
|
||||
GLM_FUNC_DECL tmat4x4<T, P> & operator--();
|
||||
GLM_FUNC_DECL tmat4x4<T, P> operator++(int);
|
||||
GLM_FUNC_DECL tmat4x4<T, P> operator--(int);
|
||||
};
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tmat4x4<T, P> compute_inverse_mat4(tmat4x4<T, P> const & m);
|
||||
|
||||
// Binary operators
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tmat4x4<T, P> operator+ (
|
||||
tmat4x4<T, P> const & m,
|
||||
T const & s);
|
||||
GLM_FUNC_DECL tmat4x4<T, P> operator+(tmat4x4<T, P> const & m, T const & s);
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tmat4x4<T, P> operator+ (
|
||||
T const & s,
|
||||
tmat4x4<T, P> const & m);
|
||||
GLM_FUNC_DECL tmat4x4<T, P> operator+(T const & s, tmat4x4<T, P> const & m);
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tmat4x4<T, P> operator+ (
|
||||
tmat4x4<T, P> const & m1,
|
||||
tmat4x4<T, P> const & m2);
|
||||
GLM_FUNC_DECL tmat4x4<T, P> operator+(tmat4x4<T, P> const & m1, tmat4x4<T, P> const & m2);
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tmat4x4<T, P> operator- (
|
||||
tmat4x4<T, P> const & m,
|
||||
T const & s);
|
||||
GLM_FUNC_DECL tmat4x4<T, P> operator-(tmat4x4<T, P> const & m, T const & s);
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tmat4x4<T, P> operator- (
|
||||
T const & s,
|
||||
tmat4x4<T, P> const & m);
|
||||
GLM_FUNC_DECL tmat4x4<T, P> operator-(T const & s, tmat4x4<T, P> const & m);
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tmat4x4<T, P> operator- (
|
||||
tmat4x4<T, P> const & m1,
|
||||
tmat4x4<T, P> const & m2);
|
||||
GLM_FUNC_DECL tmat4x4<T, P> operator-(tmat4x4<T, P> const & m1, tmat4x4<T, P> const & m2);
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tmat4x4<T, P> operator* (
|
||||
tmat4x4<T, P> const & m,
|
||||
T const & s);
|
||||
GLM_FUNC_DECL tmat4x4<T, P> operator*(tmat4x4<T, P> const & m, T const & s);
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tmat4x4<T, P> operator* (
|
||||
T const & s,
|
||||
tmat4x4<T, P> const & m);
|
||||
GLM_FUNC_DECL tmat4x4<T, P> operator*(T const & s, tmat4x4<T, P> const & m);
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL typename tmat4x4<T, P>::col_type operator* (
|
||||
tmat4x4<T, P> const & m,
|
||||
typename tmat4x4<T, P>::row_type const & v);
|
||||
GLM_FUNC_DECL typename tmat4x4<T, P>::col_type operator*(tmat4x4<T, P> const & m, typename tmat4x4<T, P>::row_type const & v);
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL typename tmat4x4<T, P>::row_type operator* (
|
||||
typename tmat4x4<T, P>::col_type const & v,
|
||||
tmat4x4<T, P> const & m);
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tmat2x4<T, P> operator* (
|
||||
tmat4x4<T, P> const & m1,
|
||||
tmat2x4<T, P> const & m2);
|
||||
GLM_FUNC_DECL typename tmat4x4<T, P>::row_type operator*(typename tmat4x4<T, P>::col_type const & v, tmat4x4<T, P> const & m);
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tmat3x4<T, P> operator* (
|
||||
tmat4x4<T, P> const & m1,
|
||||
tmat3x4<T, P> const & m2);
|
||||
GLM_FUNC_DECL tmat2x4<T, P> operator*(tmat4x4<T, P> const & m1, tmat2x4<T, P> const & m2);
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tmat4x4<T, P> operator* (
|
||||
tmat4x4<T, P> const & m1,
|
||||
tmat4x4<T, P> const & m2);
|
||||
GLM_FUNC_DECL tmat3x4<T, P> operator*(tmat4x4<T, P> const & m1, tmat3x4<T, P> const & m2);
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tmat4x4<T, P> operator/ (
|
||||
tmat4x4<T, P> const & m,
|
||||
T const & s);
|
||||
GLM_FUNC_DECL tmat4x4<T, P> operator*(tmat4x4<T, P> const & m1, tmat4x4<T, P> const & m2);
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tmat4x4<T, P> operator/ (
|
||||
T const & s,
|
||||
tmat4x4<T, P> const & m);
|
||||
GLM_FUNC_DECL tmat4x4<T, P> operator/(tmat4x4<T, P> const & m, T const & s);
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL typename tmat4x4<T, P>::col_type operator/ (
|
||||
tmat4x4<T, P> const & m,
|
||||
typename tmat4x4<T, P>::row_type const & v);
|
||||
GLM_FUNC_DECL tmat4x4<T, P> operator/(T const & s, tmat4x4<T, P> const & m);
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL typename tmat4x4<T, P>::row_type operator/ (
|
||||
typename tmat4x4<T, P>::col_type & v,
|
||||
tmat4x4<T, P> const & m);
|
||||
GLM_FUNC_DECL typename tmat4x4<T, P>::col_type operator/(tmat4x4<T, P> const & m, typename tmat4x4<T, P>::row_type const & v);
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tmat4x4<T, P> operator/ (
|
||||
tmat4x4<T, P> const & m1,
|
||||
tmat4x4<T, P> const & m2);
|
||||
GLM_FUNC_DECL typename tmat4x4<T, P>::row_type operator/(typename tmat4x4<T, P>::col_type & v, tmat4x4<T, P> const & m);
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tmat4x4<T, P> operator/(tmat4x4<T, P> const & m1, tmat4x4<T, P> const & m2);
|
||||
|
||||
// Unary constant operators
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tmat4x4<T, P> const operator- (
|
||||
tmat4x4<T, P> const & m);
|
||||
|
||||
}//namespace detail
|
||||
GLM_FUNC_DECL tmat4x4<T, P> const operator-(tmat4x4<T, P> const & m);
|
||||
}//namespace glm
|
||||
|
||||
#ifndef GLM_EXTERNAL_TEMPLATE
|
||||
#include "type_mat4x4.inl"
|
||||
#endif//GLM_EXTERNAL_TEMPLATE
|
||||
|
||||
#endif//glm_core_type_mat4x4
|
||||
|
||||
@ -12,6 +12,10 @@
|
||||
/// 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
|
||||
@ -21,7 +25,7 @@
|
||||
/// THE SOFTWARE.
|
||||
///
|
||||
/// @ref core
|
||||
/// @file glm/core/type_mat4x4.inl
|
||||
/// @file glm/detail/type_mat4x4.inl
|
||||
/// @date 2005-01-27 / 2011-06-15
|
||||
/// @author Christophe Riccio
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
@ -30,35 +34,63 @@ namespace glm{
|
||||
namespace detail
|
||||
{
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR length_t tmat4x4<T, P>::length() const
|
||||
GLM_FUNC_QUALIFIER tmat4x4<T, P> compute_inverse(tmat4x4<T, P> const & m)
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
T Coef00 = m[2][2] * m[3][3] - m[3][2] * m[2][3];
|
||||
T Coef02 = m[1][2] * m[3][3] - m[3][2] * m[1][3];
|
||||
T Coef03 = m[1][2] * m[2][3] - m[2][2] * m[1][3];
|
||||
|
||||
//////////////////////////////////////
|
||||
// Accesses
|
||||
T Coef04 = m[2][1] * m[3][3] - m[3][1] * m[2][3];
|
||||
T Coef06 = m[1][1] * m[3][3] - m[3][1] * m[1][3];
|
||||
T Coef07 = m[1][1] * m[2][3] - m[2][1] * m[1][3];
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER typename tmat4x4<T, P>::col_type &
|
||||
tmat4x4<T, P>::operator[]
|
||||
(
|
||||
length_t i
|
||||
)
|
||||
{
|
||||
assert(i < this->length());
|
||||
return this->value[i];
|
||||
}
|
||||
T Coef08 = m[2][1] * m[3][2] - m[3][1] * m[2][2];
|
||||
T Coef10 = m[1][1] * m[3][2] - m[3][1] * m[1][2];
|
||||
T Coef11 = m[1][1] * m[2][2] - m[2][1] * m[1][2];
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER typename tmat4x4<T, P>::col_type const &
|
||||
tmat4x4<T, P>::operator[]
|
||||
(
|
||||
length_t i
|
||||
) const
|
||||
{
|
||||
assert(i < this->length());
|
||||
return this->value[i];
|
||||
T Coef12 = m[2][0] * m[3][3] - m[3][0] * m[2][3];
|
||||
T Coef14 = m[1][0] * m[3][3] - m[3][0] * m[1][3];
|
||||
T Coef15 = m[1][0] * m[2][3] - m[2][0] * m[1][3];
|
||||
|
||||
T Coef16 = m[2][0] * m[3][2] - m[3][0] * m[2][2];
|
||||
T Coef18 = m[1][0] * m[3][2] - m[3][0] * m[1][2];
|
||||
T Coef19 = m[1][0] * m[2][2] - m[2][0] * m[1][2];
|
||||
|
||||
T Coef20 = m[2][0] * m[3][1] - m[3][0] * m[2][1];
|
||||
T Coef22 = m[1][0] * m[3][1] - m[3][0] * m[1][1];
|
||||
T Coef23 = m[1][0] * m[2][1] - m[2][0] * m[1][1];
|
||||
|
||||
tvec4<T, P> Fac0(Coef00, Coef00, Coef02, Coef03);
|
||||
tvec4<T, P> Fac1(Coef04, Coef04, Coef06, Coef07);
|
||||
tvec4<T, P> Fac2(Coef08, Coef08, Coef10, Coef11);
|
||||
tvec4<T, P> Fac3(Coef12, Coef12, Coef14, Coef15);
|
||||
tvec4<T, P> Fac4(Coef16, Coef16, Coef18, Coef19);
|
||||
tvec4<T, P> Fac5(Coef20, Coef20, Coef22, Coef23);
|
||||
|
||||
tvec4<T, P> Vec0(m[1][0], m[0][0], m[0][0], m[0][0]);
|
||||
tvec4<T, P> Vec1(m[1][1], m[0][1], m[0][1], m[0][1]);
|
||||
tvec4<T, P> Vec2(m[1][2], m[0][2], m[0][2], m[0][2]);
|
||||
tvec4<T, P> Vec3(m[1][3], m[0][3], m[0][3], m[0][3]);
|
||||
|
||||
tvec4<T, P> Inv0(Vec1 * Fac0 - Vec2 * Fac1 + Vec3 * Fac2);
|
||||
tvec4<T, P> Inv1(Vec0 * Fac0 - Vec2 * Fac3 + Vec3 * Fac4);
|
||||
tvec4<T, P> Inv2(Vec0 * Fac1 - Vec1 * Fac3 + Vec3 * Fac5);
|
||||
tvec4<T, P> Inv3(Vec0 * Fac2 - Vec1 * Fac4 + Vec2 * Fac5);
|
||||
|
||||
tvec4<T, P> SignA(+1, -1, +1, -1);
|
||||
tvec4<T, P> SignB(-1, +1, -1, +1);
|
||||
tmat4x4<T, P> Inverse(Inv0 * SignA, Inv1 * SignB, Inv2 * SignA, Inv3 * SignB);
|
||||
|
||||
tvec4<T, P> Row0(Inverse[0][0], Inverse[1][0], Inverse[2][0], Inverse[3][0]);
|
||||
|
||||
tvec4<T, P> Dot0(m[0] * Row0);
|
||||
T Dot1 = (Dot0.x + Dot0.y) + (Dot0.z + Dot0.w);
|
||||
|
||||
T OneOverDeterminant = static_cast<T>(1) / Dot1;
|
||||
|
||||
return Inverse * OneOverDeterminant;
|
||||
}
|
||||
}//namespace detail
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
// Constructors
|
||||
@ -66,32 +98,17 @@ namespace detail
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat4x4<T, P>::tmat4x4()
|
||||
{
|
||||
T Zero(0);
|
||||
T One(1);
|
||||
this->value[0] = col_type(One, Zero, Zero, Zero);
|
||||
this->value[1] = col_type(Zero, One, Zero, Zero);
|
||||
this->value[2] = col_type(Zero, Zero, One, Zero);
|
||||
this->value[3] = col_type(Zero, Zero, Zero, One);
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat4x4<T, P>::tmat4x4
|
||||
(
|
||||
tmat4x4<T, P> const & m
|
||||
)
|
||||
{
|
||||
this->value[0] = m[0];
|
||||
this->value[1] = m[1];
|
||||
this->value[2] = m[2];
|
||||
this->value[3] = m[3];
|
||||
# ifndef GLM_FORCE_NO_CTOR_INIT
|
||||
this->value[0] = col_type(1, 0, 0, 0);
|
||||
this->value[1] = col_type(0, 1, 0, 0);
|
||||
this->value[2] = col_type(0, 0, 1, 0);
|
||||
this->value[3] = col_type(0, 0, 0, 1);
|
||||
# endif
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
template <precision Q>
|
||||
GLM_FUNC_QUALIFIER tmat4x4<T, P>::tmat4x4
|
||||
(
|
||||
tmat4x4<T, Q> const & m
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat4x4<T, P>::tmat4x4(tmat4x4<T, Q> const & m)
|
||||
{
|
||||
this->value[0] = m[0];
|
||||
this->value[1] = m[1];
|
||||
@ -100,23 +117,16 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat4x4<T, P>::tmat4x4
|
||||
(
|
||||
ctor
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat4x4<T, P>::tmat4x4(ctor)
|
||||
{}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat4x4<T, P>::tmat4x4
|
||||
(
|
||||
T const & s
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat4x4<T, P>::tmat4x4(T const & s)
|
||||
{
|
||||
value_type const Zero(0);
|
||||
this->value[0] = col_type(s, Zero, Zero, Zero);
|
||||
this->value[1] = col_type(Zero, s, Zero, Zero);
|
||||
this->value[2] = col_type(Zero, Zero, s, Zero);
|
||||
this->value[3] = col_type(Zero, Zero, Zero, s);
|
||||
this->value[0] = col_type(s, 0, 0, 0);
|
||||
this->value[1] = col_type(0, s, 0, 0);
|
||||
this->value[2] = col_type(0, 0, s, 0);
|
||||
this->value[3] = col_type(0, 0, 0, s);
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
@ -228,125 +238,128 @@ namespace detail
|
||||
//////////////////////////////////////
|
||||
// Matrix convertion constructors
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat4x4<T, P>::tmat4x4
|
||||
(
|
||||
tmat2x2<T, P> const & m
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat4x4<T, P>::tmat4x4(tmat2x2<T, P> const & m)
|
||||
{
|
||||
this->value[0] = col_type(m[0], detail::tvec2<T, P>(0));
|
||||
this->value[1] = col_type(m[1], detail::tvec2<T, P>(0));
|
||||
this->value[2] = col_type(static_cast<T>(0));
|
||||
this->value[3] = col_type(static_cast<T>(0), value_type(0), value_type(0), value_type(1));
|
||||
this->value[0] = col_type(m[0], 0, 0);
|
||||
this->value[1] = col_type(m[1], 0, 0);
|
||||
this->value[2] = col_type(0);
|
||||
this->value[3] = col_type(0, 0, 0, 1);
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat4x4<T, P>::tmat4x4
|
||||
(
|
||||
tmat3x3<T, P> const & m
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat4x4<T, P>::tmat4x4(tmat3x3<T, P> const & m)
|
||||
{
|
||||
this->value[0] = col_type(m[0], value_type(0));
|
||||
this->value[1] = col_type(m[1], value_type(0));
|
||||
this->value[2] = col_type(m[2], value_type(0));
|
||||
this->value[3] = col_type(static_cast<T>(0), value_type(0), value_type(0), value_type(1));
|
||||
this->value[0] = col_type(m[0], 0);
|
||||
this->value[1] = col_type(m[1], 0);
|
||||
this->value[2] = col_type(m[2], 0);
|
||||
this->value[3] = col_type(0, 0, 0, 1);
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat4x4<T, P>::tmat4x4
|
||||
(
|
||||
tmat2x3<T, P> const & m
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat4x4<T, P>::tmat4x4(tmat2x3<T, P> const & m)
|
||||
{
|
||||
this->value[0] = col_type(m[0], value_type(0));
|
||||
this->value[1] = col_type(m[1], value_type(0));
|
||||
this->value[2] = col_type(static_cast<T>(0));
|
||||
this->value[3] = col_type(static_cast<T>(0), value_type(0), value_type(0), value_type(1));
|
||||
this->value[0] = col_type(m[0], 0);
|
||||
this->value[1] = col_type(m[1], 0);
|
||||
this->value[2] = col_type(0);
|
||||
this->value[3] = col_type(0, 0, 0, 1);
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat4x4<T, P>::tmat4x4
|
||||
(
|
||||
tmat3x2<T, P> const & m
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat4x4<T, P>::tmat4x4(tmat3x2<T, P> const & m)
|
||||
{
|
||||
this->value[0] = col_type(m[0], detail::tvec2<T, P>(0));
|
||||
this->value[1] = col_type(m[1], detail::tvec2<T, P>(0));
|
||||
this->value[2] = col_type(m[2], detail::tvec2<T, P>(0));
|
||||
this->value[3] = col_type(static_cast<T>(0), value_type(0), value_type(0), value_type(1));
|
||||
this->value[0] = col_type(m[0], 0, 0);
|
||||
this->value[1] = col_type(m[1], 0, 0);
|
||||
this->value[2] = col_type(m[2], 0, 0);
|
||||
this->value[3] = col_type(0, 0, 0, 1);
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat4x4<T, P>::tmat4x4
|
||||
(
|
||||
tmat2x4<T, P> const & m
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat4x4<T, P>::tmat4x4(tmat2x4<T, P> const & m)
|
||||
{
|
||||
this->value[0] = m[0];
|
||||
this->value[1] = m[1];
|
||||
this->value[2] = col_type(T(0));
|
||||
this->value[3] = col_type(T(0), T(0), T(0), T(1));
|
||||
this->value[2] = col_type(0);
|
||||
this->value[3] = col_type(0, 0, 0, 1);
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat4x4<T, P>::tmat4x4
|
||||
(
|
||||
tmat4x2<T, P> const & m
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat4x4<T, P>::tmat4x4(tmat4x2<T, P> const & m)
|
||||
{
|
||||
this->value[0] = col_type(m[0], detail::tvec2<T, P>(0));
|
||||
this->value[1] = col_type(m[1], detail::tvec2<T, P>(0));
|
||||
this->value[2] = col_type(T(0));
|
||||
this->value[3] = col_type(T(0), T(0), T(0), T(1));
|
||||
this->value[0] = col_type(m[0], 0, 0);
|
||||
this->value[1] = col_type(m[1], 0, 0);
|
||||
this->value[2] = col_type(0);
|
||||
this->value[3] = col_type(0, 0, 0, 1);
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat4x4<T, P>::tmat4x4
|
||||
(
|
||||
tmat3x4<T, P> const & m
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat4x4<T, P>::tmat4x4(tmat3x4<T, P> const & m)
|
||||
{
|
||||
this->value[0] = m[0];
|
||||
this->value[1] = m[1];
|
||||
this->value[2] = m[2];
|
||||
this->value[3] = col_type(T(0), T(0), T(0), T(1));
|
||||
this->value[3] = col_type(0, 0, 0, 1);
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat4x4<T, P>::tmat4x4
|
||||
(
|
||||
tmat4x3<T, P> const & m
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat4x4<T, P>::tmat4x4(tmat4x3<T, P> const & m)
|
||||
{
|
||||
this->value[0] = col_type(m[0], T(0));
|
||||
this->value[1] = col_type(m[1], T(0));
|
||||
this->value[2] = col_type(m[2], T(0));
|
||||
this->value[3] = col_type(m[3], T(1));
|
||||
this->value[0] = col_type(m[0], 0);
|
||||
this->value[1] = col_type(m[1], 0);
|
||||
this->value[2] = col_type(m[2], 0);
|
||||
this->value[3] = col_type(m[3], 1);
|
||||
}
|
||||
|
||||
//////////////////////////////////////
|
||||
// Accesses
|
||||
|
||||
# ifdef GLM_FORCE_SIZE_FUNC
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tmat4x4<T, P>::size_type tmat4x4<T, P>::size() const
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER typename tmat4x4<T, P>::col_type & tmat4x4<T, P>::operator[](typename tmat4x4<T, P>::size_type i)
|
||||
{
|
||||
assert(i < this->size());
|
||||
return this->value[i];
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER typename tmat4x4<T, P>::col_type const & tmat4x4<T, P>::operator[](typename tmat4x4<T, P>::size_type i) const
|
||||
{
|
||||
assert(i < this->size());
|
||||
return this->value[i];
|
||||
}
|
||||
# else
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tmat4x4<T, P>::length_type tmat4x4<T, P>::length() const
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER typename tmat4x4<T, P>::col_type & tmat4x4<T, P>::operator[](typename tmat4x4<T, P>::length_type i)
|
||||
{
|
||||
assert(i < this->length());
|
||||
return this->value[i];
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER typename tmat4x4<T, P>::col_type const & tmat4x4<T, P>::operator[](typename tmat4x4<T, P>::length_type i) const
|
||||
{
|
||||
assert(i < this->length());
|
||||
return this->value[i];
|
||||
}
|
||||
# endif//GLM_FORCE_SIZE_FUNC
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
// Operators
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat4x4<T, P>& tmat4x4<T, P>::operator=
|
||||
(
|
||||
tmat4x4<T, P> const & m
|
||||
)
|
||||
{
|
||||
//memcpy could be faster
|
||||
//memcpy(&this->value, &m.value, 16 * sizeof(valType));
|
||||
this->value[0] = m[0];
|
||||
this->value[1] = m[1];
|
||||
this->value[2] = m[2];
|
||||
this->value[3] = m[3];
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
template <typename U>
|
||||
GLM_FUNC_QUALIFIER tmat4x4<T, P>& tmat4x4<T, P>::operator=
|
||||
(
|
||||
tmat4x4<U, P> const & m
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat4x4<T, P>& tmat4x4<T, P>::operator=(tmat4x4<U, P> const & m)
|
||||
{
|
||||
//memcpy could be faster
|
||||
//memcpy(&this->value, &m.value, 16 * sizeof(valType));
|
||||
@ -359,7 +372,7 @@ namespace detail
|
||||
|
||||
template <typename T, precision P>
|
||||
template <typename U>
|
||||
GLM_FUNC_QUALIFIER tmat4x4<T, P>& tmat4x4<T, P>::operator+= (U s)
|
||||
GLM_FUNC_QUALIFIER tmat4x4<T, P>& tmat4x4<T, P>::operator+=(U s)
|
||||
{
|
||||
this->value[0] += s;
|
||||
this->value[1] += s;
|
||||
@ -370,7 +383,7 @@ namespace detail
|
||||
|
||||
template <typename T, precision P>
|
||||
template <typename U>
|
||||
GLM_FUNC_QUALIFIER tmat4x4<T, P>& tmat4x4<T, P>::operator+= (tmat4x4<U, P> const & m)
|
||||
GLM_FUNC_QUALIFIER tmat4x4<T, P>& tmat4x4<T, P>::operator+=(tmat4x4<U, P> const & m)
|
||||
{
|
||||
this->value[0] += m[0];
|
||||
this->value[1] += m[1];
|
||||
@ -381,7 +394,7 @@ namespace detail
|
||||
|
||||
template <typename T, precision P>
|
||||
template <typename U>
|
||||
GLM_FUNC_QUALIFIER tmat4x4<T, P> & tmat4x4<T, P>::operator-= (U s)
|
||||
GLM_FUNC_QUALIFIER tmat4x4<T, P> & tmat4x4<T, P>::operator-=(U s)
|
||||
{
|
||||
this->value[0] -= s;
|
||||
this->value[1] -= s;
|
||||
@ -392,7 +405,7 @@ namespace detail
|
||||
|
||||
template <typename T, precision P>
|
||||
template <typename U>
|
||||
GLM_FUNC_QUALIFIER tmat4x4<T, P> & tmat4x4<T, P>::operator-= (tmat4x4<U, P> const & m)
|
||||
GLM_FUNC_QUALIFIER tmat4x4<T, P> & tmat4x4<T, P>::operator-=(tmat4x4<U, P> const & m)
|
||||
{
|
||||
this->value[0] -= m[0];
|
||||
this->value[1] -= m[1];
|
||||
@ -403,7 +416,7 @@ namespace detail
|
||||
|
||||
template <typename T, precision P>
|
||||
template <typename U>
|
||||
GLM_FUNC_QUALIFIER tmat4x4<T, P> & tmat4x4<T, P>::operator*= (U s)
|
||||
GLM_FUNC_QUALIFIER tmat4x4<T, P> & tmat4x4<T, P>::operator*=(U s)
|
||||
{
|
||||
this->value[0] *= s;
|
||||
this->value[1] *= s;
|
||||
@ -414,14 +427,14 @@ namespace detail
|
||||
|
||||
template <typename T, precision P>
|
||||
template <typename U>
|
||||
GLM_FUNC_QUALIFIER tmat4x4<T, P> & tmat4x4<T, P>::operator*= (tmat4x4<U, P> const & m)
|
||||
GLM_FUNC_QUALIFIER tmat4x4<T, P> & tmat4x4<T, P>::operator*=(tmat4x4<U, P> const & m)
|
||||
{
|
||||
return (*this = *this * m);
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
template <typename U>
|
||||
GLM_FUNC_QUALIFIER tmat4x4<T, P> & tmat4x4<T, P>::operator/= (U s)
|
||||
GLM_FUNC_QUALIFIER tmat4x4<T, P> & tmat4x4<T, P>::operator/=(U s)
|
||||
{
|
||||
this->value[0] /= s;
|
||||
this->value[1] /= s;
|
||||
@ -432,13 +445,13 @@ namespace detail
|
||||
|
||||
template <typename T, precision P>
|
||||
template <typename U>
|
||||
GLM_FUNC_QUALIFIER tmat4x4<T, P> & tmat4x4<T, P>::operator/= (tmat4x4<U, P> const & m)
|
||||
GLM_FUNC_QUALIFIER tmat4x4<T, P> & tmat4x4<T, P>::operator/=(tmat4x4<U, P> const & m)
|
||||
{
|
||||
return (*this = *this * detail::compute_inverse<detail::tmat4x4, T, P>::call(m));
|
||||
return (*this = *this * detail::compute_inverse<T, P>(m));
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat4x4<T, P> & tmat4x4<T, P>::operator++ ()
|
||||
GLM_FUNC_QUALIFIER tmat4x4<T, P> & tmat4x4<T, P>::operator++()
|
||||
{
|
||||
++this->value[0];
|
||||
++this->value[1];
|
||||
@ -448,7 +461,7 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat4x4<T, P> & tmat4x4<T, P>::operator-- ()
|
||||
GLM_FUNC_QUALIFIER tmat4x4<T, P> & tmat4x4<T, P>::operator--()
|
||||
{
|
||||
--this->value[0];
|
||||
--this->value[1];
|
||||
@ -473,74 +486,9 @@ namespace detail
|
||||
return Result;
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
struct compute_inverse<detail::tmat4x4, T, P>
|
||||
{
|
||||
static detail::tmat4x4<T, P> call(detail::tmat4x4<T, P> const & m)
|
||||
{
|
||||
T Coef00 = m[2][2] * m[3][3] - m[3][2] * m[2][3];
|
||||
T Coef02 = m[1][2] * m[3][3] - m[3][2] * m[1][3];
|
||||
T Coef03 = m[1][2] * m[2][3] - m[2][2] * m[1][3];
|
||||
|
||||
T Coef04 = m[2][1] * m[3][3] - m[3][1] * m[2][3];
|
||||
T Coef06 = m[1][1] * m[3][3] - m[3][1] * m[1][3];
|
||||
T Coef07 = m[1][1] * m[2][3] - m[2][1] * m[1][3];
|
||||
|
||||
T Coef08 = m[2][1] * m[3][2] - m[3][1] * m[2][2];
|
||||
T Coef10 = m[1][1] * m[3][2] - m[3][1] * m[1][2];
|
||||
T Coef11 = m[1][1] * m[2][2] - m[2][1] * m[1][2];
|
||||
|
||||
T Coef12 = m[2][0] * m[3][3] - m[3][0] * m[2][3];
|
||||
T Coef14 = m[1][0] * m[3][3] - m[3][0] * m[1][3];
|
||||
T Coef15 = m[1][0] * m[2][3] - m[2][0] * m[1][3];
|
||||
|
||||
T Coef16 = m[2][0] * m[3][2] - m[3][0] * m[2][2];
|
||||
T Coef18 = m[1][0] * m[3][2] - m[3][0] * m[1][2];
|
||||
T Coef19 = m[1][0] * m[2][2] - m[2][0] * m[1][2];
|
||||
|
||||
T Coef20 = m[2][0] * m[3][1] - m[3][0] * m[2][1];
|
||||
T Coef22 = m[1][0] * m[3][1] - m[3][0] * m[1][1];
|
||||
T Coef23 = m[1][0] * m[2][1] - m[2][0] * m[1][1];
|
||||
|
||||
detail::tvec4<T, P> Fac0(Coef00, Coef00, Coef02, Coef03);
|
||||
detail::tvec4<T, P> Fac1(Coef04, Coef04, Coef06, Coef07);
|
||||
detail::tvec4<T, P> Fac2(Coef08, Coef08, Coef10, Coef11);
|
||||
detail::tvec4<T, P> Fac3(Coef12, Coef12, Coef14, Coef15);
|
||||
detail::tvec4<T, P> Fac4(Coef16, Coef16, Coef18, Coef19);
|
||||
detail::tvec4<T, P> Fac5(Coef20, Coef20, Coef22, Coef23);
|
||||
|
||||
detail::tvec4<T, P> Vec0(m[1][0], m[0][0], m[0][0], m[0][0]);
|
||||
detail::tvec4<T, P> Vec1(m[1][1], m[0][1], m[0][1], m[0][1]);
|
||||
detail::tvec4<T, P> Vec2(m[1][2], m[0][2], m[0][2], m[0][2]);
|
||||
detail::tvec4<T, P> Vec3(m[1][3], m[0][3], m[0][3], m[0][3]);
|
||||
|
||||
detail::tvec4<T, P> Inv0(Vec1 * Fac0 - Vec2 * Fac1 + Vec3 * Fac2);
|
||||
detail::tvec4<T, P> Inv1(Vec0 * Fac0 - Vec2 * Fac3 + Vec3 * Fac4);
|
||||
detail::tvec4<T, P> Inv2(Vec0 * Fac1 - Vec1 * Fac3 + Vec3 * Fac5);
|
||||
detail::tvec4<T, P> Inv3(Vec0 * Fac2 - Vec1 * Fac4 + Vec2 * Fac5);
|
||||
|
||||
detail::tvec4<T, P> SignA(+1, -1, +1, -1);
|
||||
detail::tvec4<T, P> SignB(-1, +1, -1, +1);
|
||||
detail::tmat4x4<T, P> Inverse(Inv0 * SignA, Inv1 * SignB, Inv2 * SignA, Inv3 * SignB);
|
||||
|
||||
detail::tvec4<T, P> Row0(Inverse[0][0], Inverse[1][0], Inverse[2][0], Inverse[3][0]);
|
||||
|
||||
detail::tvec4<T, P> Dot0(m[0] * Row0);
|
||||
T Dot1 = (Dot0.x + Dot0.y) + (Dot0.z + Dot0.w);
|
||||
|
||||
T OneOverDeterminant = static_cast<T>(1) / Dot1;
|
||||
|
||||
return Inverse * OneOverDeterminant;
|
||||
}
|
||||
};
|
||||
|
||||
// Binary operators
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat4x4<T, P> operator+
|
||||
(
|
||||
tmat4x4<T, P> const & m,
|
||||
T const & s
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat4x4<T, P> operator+(tmat4x4<T, P> const & m, T const & s)
|
||||
{
|
||||
return tmat4x4<T, P>(
|
||||
m[0] + s,
|
||||
@ -550,11 +498,7 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat4x4<T, P> operator+
|
||||
(
|
||||
T const & s,
|
||||
tmat4x4<T, P> const & m
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat4x4<T, P> operator+(T const & s, tmat4x4<T, P> const & m)
|
||||
{
|
||||
return tmat4x4<T, P>(
|
||||
m[0] + s,
|
||||
@ -564,11 +508,7 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat4x4<T, P> operator+
|
||||
(
|
||||
tmat4x4<T, P> const & m1,
|
||||
tmat4x4<T, P> const & m2
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat4x4<T, P> operator+(tmat4x4<T, P> const & m1, tmat4x4<T, P> const & m2)
|
||||
{
|
||||
return tmat4x4<T, P>(
|
||||
m1[0] + m2[0],
|
||||
@ -578,11 +518,7 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat4x4<T, P> operator-
|
||||
(
|
||||
tmat4x4<T, P> const & m,
|
||||
T const & s
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat4x4<T, P> operator-(tmat4x4<T, P> const & m, T const & s)
|
||||
{
|
||||
return tmat4x4<T, P>(
|
||||
m[0] - s,
|
||||
@ -592,11 +528,7 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat4x4<T, P> operator-
|
||||
(
|
||||
T const & s,
|
||||
tmat4x4<T, P> const & m
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat4x4<T, P> operator-(T const & s, tmat4x4<T, P> const & m)
|
||||
{
|
||||
return tmat4x4<T, P>(
|
||||
s - m[0],
|
||||
@ -606,11 +538,7 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat4x4<T, P> operator-
|
||||
(
|
||||
tmat4x4<T, P> const & m1,
|
||||
tmat4x4<T, P> const & m2
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat4x4<T, P> operator-(tmat4x4<T, P> const & m1, tmat4x4<T, P> const & m2)
|
||||
{
|
||||
return tmat4x4<T, P>(
|
||||
m1[0] - m2[0],
|
||||
@ -620,11 +548,7 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat4x4<T, P> operator*
|
||||
(
|
||||
tmat4x4<T, P> const & m,
|
||||
T const & s
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat4x4<T, P> operator*(tmat4x4<T, P> const & m, T const & s)
|
||||
{
|
||||
return tmat4x4<T, P>(
|
||||
m[0] * s,
|
||||
@ -634,11 +558,7 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat4x4<T, P> operator*
|
||||
(
|
||||
T const & s,
|
||||
tmat4x4<T, P> const & m
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat4x4<T, P> operator*(T const & s, tmat4x4<T, P> const & m)
|
||||
{
|
||||
return tmat4x4<T, P>(
|
||||
m[0] * s,
|
||||
@ -710,11 +630,7 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat2x4<T, P> operator*
|
||||
(
|
||||
tmat4x4<T, P> const & m1,
|
||||
tmat2x4<T, P> const & m2
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat2x4<T, P> operator*(tmat4x4<T, P> const & m1, tmat2x4<T, P> const & m2)
|
||||
{
|
||||
return tmat2x4<T, P>(
|
||||
m1[0][0] * m2[0][0] + m1[1][0] * m2[0][1] + m1[2][0] * m2[0][2] + m1[3][0] * m2[0][3],
|
||||
@ -728,11 +644,7 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat3x4<T, P> operator*
|
||||
(
|
||||
tmat4x4<T, P> const & m1,
|
||||
tmat3x4<T, P> const & m2
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat3x4<T, P> operator*(tmat4x4<T, P> const & m1, tmat3x4<T, P> const & m2)
|
||||
{
|
||||
return tmat3x4<T, P>(
|
||||
m1[0][0] * m2[0][0] + m1[1][0] * m2[0][1] + m1[2][0] * m2[0][2] + m1[3][0] * m2[0][3],
|
||||
@ -750,11 +662,7 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat4x4<T, P> operator*
|
||||
(
|
||||
tmat4x4<T, P> const & m1,
|
||||
tmat4x4<T, P> const & m2
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat4x4<T, P> operator*(tmat4x4<T, P> const & m1, tmat4x4<T, P> const & m2)
|
||||
{
|
||||
typename tmat4x4<T, P>::col_type const SrcA0 = m1[0];
|
||||
typename tmat4x4<T, P>::col_type const SrcA1 = m1[1];
|
||||
@ -766,7 +674,7 @@ namespace detail
|
||||
typename tmat4x4<T, P>::col_type const SrcB2 = m2[2];
|
||||
typename tmat4x4<T, P>::col_type const SrcB3 = m2[3];
|
||||
|
||||
tmat4x4<T, P> Result(tmat4x4<T, P>::_null);
|
||||
tmat4x4<T, P> Result(uninitialize);
|
||||
Result[0] = SrcA0 * SrcB0[0] + SrcA1 * SrcB0[1] + SrcA2 * SrcB0[2] + SrcA3 * SrcB0[3];
|
||||
Result[1] = SrcA0 * SrcB1[0] + SrcA1 * SrcB1[1] + SrcA2 * SrcB1[2] + SrcA3 * SrcB1[3];
|
||||
Result[2] = SrcA0 * SrcB2[0] + SrcA1 * SrcB2[1] + SrcA2 * SrcB2[2] + SrcA3 * SrcB2[3];
|
||||
@ -775,11 +683,7 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat4x4<T, P> operator/
|
||||
(
|
||||
tmat4x4<T, P> const & m,
|
||||
T const & s
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat4x4<T, P> operator/(tmat4x4<T, P> const & m, T const & s)
|
||||
{
|
||||
return tmat4x4<T, P>(
|
||||
m[0] / s,
|
||||
@ -789,11 +693,7 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat4x4<T, P> operator/
|
||||
(
|
||||
T const & s,
|
||||
tmat4x4<T, P> const & m
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat4x4<T, P> operator/(T const & s, tmat4x4<T, P> const & m)
|
||||
{
|
||||
return tmat4x4<T, P>(
|
||||
s / m[0],
|
||||
@ -803,31 +703,19 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER typename tmat4x4<T, P>::col_type operator/
|
||||
(
|
||||
tmat4x4<T, P> const & m,
|
||||
typename tmat4x4<T, P>::row_type const & v
|
||||
)
|
||||
GLM_FUNC_QUALIFIER typename tmat4x4<T, P>::col_type operator/(tmat4x4<T, P> const & m, typename tmat4x4<T, P>::row_type const & v)
|
||||
{
|
||||
return detail::compute_inverse<detail::tmat4x4, T, P>::call(m) * v;
|
||||
return detail::compute_inverse<T, P>(m) * v;
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER typename tmat4x4<T, P>::row_type operator/
|
||||
(
|
||||
typename tmat4x4<T, P>::col_type const & v,
|
||||
tmat4x4<T, P> const & m
|
||||
)
|
||||
GLM_FUNC_QUALIFIER typename tmat4x4<T, P>::row_type operator/(typename tmat4x4<T, P>::col_type const & v, tmat4x4<T, P> const & m)
|
||||
{
|
||||
return v * detail::compute_inverse<detail::tmat4x4, T, P>::call(m);
|
||||
return v * detail::compute_inverse<T, P>(m);
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat4x4<T, P> operator/
|
||||
(
|
||||
tmat4x4<T, P> const & m1,
|
||||
tmat4x4<T, P> const & m2
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat4x4<T, P> operator/(tmat4x4<T, P> const & m1, tmat4x4<T, P> const & m2)
|
||||
{
|
||||
tmat4x4<T, P> m1_copy(m1);
|
||||
return m1_copy /= m2;
|
||||
@ -835,10 +723,7 @@ namespace detail
|
||||
|
||||
// Unary constant operators
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat4x4<T, P> const operator-
|
||||
(
|
||||
tmat4x4<T, P> const & m
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat4x4<T, P> const operator-(tmat4x4<T, P> const & m)
|
||||
{
|
||||
return tmat4x4<T, P>(
|
||||
-m[0],
|
||||
@ -848,11 +733,7 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat4x4<T, P> const operator++
|
||||
(
|
||||
tmat4x4<T, P> const & m,
|
||||
int
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat4x4<T, P> const operator++(tmat4x4<T, P> const & m, int)
|
||||
{
|
||||
return tmat4x4<T, P>(
|
||||
m[0] + static_cast<T>(1),
|
||||
@ -862,11 +743,7 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tmat4x4<T, P> const operator--
|
||||
(
|
||||
tmat4x4<T, P> const & m,
|
||||
int
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tmat4x4<T, P> const operator--(tmat4x4<T, P> const & m, int)
|
||||
{
|
||||
return tmat4x4<T, P>(
|
||||
m[0] - static_cast<T>(1),
|
||||
@ -879,24 +756,14 @@ namespace detail
|
||||
// Boolean operators
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER bool operator==
|
||||
(
|
||||
tmat4x4<T, P> const & m1,
|
||||
tmat4x4<T, P> const & m2
|
||||
)
|
||||
GLM_FUNC_QUALIFIER bool operator==(tmat4x4<T, P> const & m1, tmat4x4<T, P> const & m2)
|
||||
{
|
||||
return (m1[0] == m2[0]) && (m1[1] == m2[1]) && (m1[2] == m2[2]) && (m1[3] == m2[3]);
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER bool operator!=
|
||||
(
|
||||
tmat4x4<T, P> const & m1,
|
||||
tmat4x4<T, P> const & m2
|
||||
)
|
||||
GLM_FUNC_QUALIFIER bool operator!=(tmat4x4<T, P> const & m1, tmat4x4<T, P> const & m2)
|
||||
{
|
||||
return (m1[0] != m2[0]) || (m1[1] != m2[1]) || (m1[2] != m2[2]) || (m1[3] != m2[3]);
|
||||
}
|
||||
|
||||
} //namespace detail
|
||||
} //namespace glm
|
||||
}//namespace glm
|
||||
|
||||
@ -12,6 +12,10 @@
|
||||
/// 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
|
||||
@ -21,257 +25,257 @@
|
||||
/// THE SOFTWARE.
|
||||
///
|
||||
/// @ref core
|
||||
/// @file glm/core/type_vec.hpp
|
||||
/// @date 2010-01-26 / 2011-06-15
|
||||
/// @file glm/detail/type_vec.hpp
|
||||
/// @date 2010-01-26 / 2014-10-05
|
||||
/// @author Christophe Riccio
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef glm_core_type_vec
|
||||
#define glm_core_type_vec
|
||||
#pragma once
|
||||
|
||||
#include "precision.hpp"
|
||||
#include "type_int.hpp"
|
||||
|
||||
namespace glm{
|
||||
namespace detail
|
||||
namespace glm
|
||||
{
|
||||
template <typename T, precision P> struct tvec1;
|
||||
template <typename T, precision P> struct tvec2;
|
||||
template <typename T, precision P> struct tvec3;
|
||||
template <typename T, precision P> struct tvec4;
|
||||
}//namespace detail
|
||||
|
||||
typedef detail::tvec1<float, highp> highp_vec1_t;
|
||||
typedef detail::tvec1<float, mediump> mediump_vec1_t;
|
||||
typedef detail::tvec1<float, lowp> lowp_vec1_t;
|
||||
typedef detail::tvec1<int, highp> highp_ivec1_t;
|
||||
typedef detail::tvec1<int, mediump> mediump_ivec1_t;
|
||||
typedef detail::tvec1<int, lowp> lowp_ivec1_t;
|
||||
typedef detail::tvec1<uint, highp> highp_uvec1_t;
|
||||
typedef detail::tvec1<uint, mediump> mediump_uvec1_t;
|
||||
typedef detail::tvec1<uint, lowp> lowp_uvec1_t;
|
||||
typedef detail::tvec1<bool, highp> highp_bvec1_t;
|
||||
typedef detail::tvec1<bool, mediump> mediump_bvec1_t;
|
||||
typedef detail::tvec1<bool, lowp> lowp_bvec1_t;
|
||||
|
||||
|
||||
typedef tvec1<float, highp> highp_vec1_t;
|
||||
typedef tvec1<float, mediump> mediump_vec1_t;
|
||||
typedef tvec1<float, lowp> lowp_vec1_t;
|
||||
typedef tvec1<double, highp> highp_dvec1_t;
|
||||
typedef tvec1<double, mediump> mediump_dvec1_t;
|
||||
typedef tvec1<double, lowp> lowp_dvec1_t;
|
||||
typedef tvec1<int, highp> highp_ivec1_t;
|
||||
typedef tvec1<int, mediump> mediump_ivec1_t;
|
||||
typedef tvec1<int, lowp> lowp_ivec1_t;
|
||||
typedef tvec1<uint, highp> highp_uvec1_t;
|
||||
typedef tvec1<uint, mediump> mediump_uvec1_t;
|
||||
typedef tvec1<uint, lowp> lowp_uvec1_t;
|
||||
typedef tvec1<bool, highp> highp_bvec1_t;
|
||||
typedef tvec1<bool, mediump> mediump_bvec1_t;
|
||||
typedef tvec1<bool, lowp> lowp_bvec1_t;
|
||||
|
||||
/// @addtogroup core_precision
|
||||
/// @{
|
||||
|
||||
|
||||
/// 2 components vector of high single-precision floating-point numbers.
|
||||
/// There is no guarantee on the actual precision.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.5 Vectors</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
|
||||
typedef detail::tvec2<float, highp> highp_vec2;
|
||||
|
||||
typedef tvec2<float, highp> highp_vec2;
|
||||
|
||||
/// 2 components vector of medium single-precision floating-point numbers.
|
||||
/// There is no guarantee on the actual precision.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.5 Vectors</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
|
||||
typedef detail::tvec2<float, mediump> mediump_vec2;
|
||||
|
||||
typedef tvec2<float, mediump> mediump_vec2;
|
||||
|
||||
/// 2 components vector of low single-precision floating-point numbers.
|
||||
/// There is no guarantee on the actual precision.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.5 Vectors</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
|
||||
typedef detail::tvec2<float, lowp> lowp_vec2;
|
||||
|
||||
typedef tvec2<float, lowp> lowp_vec2;
|
||||
|
||||
/// 2 components vector of high double-precision floating-point numbers.
|
||||
/// There is no guarantee on the actual precision.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.5 Vectors</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
|
||||
typedef detail::tvec2<double, highp> highp_dvec2;
|
||||
|
||||
typedef tvec2<double, highp> highp_dvec2;
|
||||
|
||||
/// 2 components vector of medium double-precision floating-point numbers.
|
||||
/// There is no guarantee on the actual precision.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.5 Vectors</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
|
||||
typedef detail::tvec2<double, mediump> mediump_dvec2;
|
||||
|
||||
typedef tvec2<double, mediump> mediump_dvec2;
|
||||
|
||||
/// 2 components vector of low double-precision floating-point numbers.
|
||||
/// There is no guarantee on the actual precision.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.5 Vectors</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
|
||||
typedef detail::tvec2<double, lowp> lowp_dvec2;
|
||||
|
||||
typedef tvec2<double, lowp> lowp_dvec2;
|
||||
|
||||
/// 2 components vector of high precision signed integer numbers.
|
||||
/// There is no guarantee on the actual precision.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.5 Vectors</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
|
||||
typedef detail::tvec2<int, highp> highp_ivec2;
|
||||
|
||||
typedef tvec2<int, highp> highp_ivec2;
|
||||
|
||||
/// 2 components vector of medium precision signed integer numbers.
|
||||
/// There is no guarantee on the actual precision.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.5 Vectors</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
|
||||
typedef detail::tvec2<int, mediump> mediump_ivec2;
|
||||
|
||||
typedef tvec2<int, mediump> mediump_ivec2;
|
||||
|
||||
/// 2 components vector of low precision signed integer numbers.
|
||||
/// There is no guarantee on the actual precision.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.5 Vectors</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
|
||||
typedef detail::tvec2<int, lowp> lowp_ivec2;
|
||||
|
||||
typedef tvec2<int, lowp> lowp_ivec2;
|
||||
|
||||
/// 2 components vector of high precision unsigned integer numbers.
|
||||
/// There is no guarantee on the actual precision.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.5 Vectors</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
|
||||
typedef detail::tvec2<uint, highp> highp_uvec2;
|
||||
|
||||
typedef tvec2<uint, highp> highp_uvec2;
|
||||
|
||||
/// 2 components vector of medium precision unsigned integer numbers.
|
||||
/// There is no guarantee on the actual precision.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.5 Vectors</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
|
||||
typedef detail::tvec2<uint, mediump> mediump_uvec2;
|
||||
|
||||
typedef tvec2<uint, mediump> mediump_uvec2;
|
||||
|
||||
/// 2 components vector of low precision unsigned integer numbers.
|
||||
/// There is no guarantee on the actual precision.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.5 Vectors</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
|
||||
typedef detail::tvec2<uint, lowp> lowp_uvec2;
|
||||
typedef tvec2<uint, lowp> lowp_uvec2;
|
||||
|
||||
/// 2 components vector of high precision bool numbers.
|
||||
/// There is no guarantee on the actual precision.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.5 Vectors</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
|
||||
typedef detail::tvec2<bool, highp> highp_bvec2;
|
||||
|
||||
typedef tvec2<bool, highp> highp_bvec2;
|
||||
|
||||
/// 2 components vector of medium precision bool numbers.
|
||||
/// There is no guarantee on the actual precision.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.5 Vectors</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
|
||||
typedef detail::tvec2<bool, mediump> mediump_bvec2;
|
||||
|
||||
typedef tvec2<bool, mediump> mediump_bvec2;
|
||||
|
||||
/// 2 components vector of low precision bool numbers.
|
||||
/// There is no guarantee on the actual precision.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.5 Vectors</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
|
||||
typedef detail::tvec2<bool, lowp> lowp_bvec2;
|
||||
|
||||
typedef tvec2<bool, lowp> lowp_bvec2;
|
||||
|
||||
/// @}
|
||||
|
||||
|
||||
|
||||
|
||||
/// @addtogroup core_precision
|
||||
/// @{
|
||||
|
||||
|
||||
/// 3 components vector of high single-precision floating-point numbers.
|
||||
/// There is no guarantee on the actual precision.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.5 Vectors</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
|
||||
typedef detail::tvec3<float, highp> highp_vec3;
|
||||
|
||||
typedef tvec3<float, highp> highp_vec3;
|
||||
|
||||
/// 3 components vector of medium single-precision floating-point numbers.
|
||||
/// There is no guarantee on the actual precision.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.5 Vectors</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
|
||||
typedef detail::tvec3<float, mediump> mediump_vec3;
|
||||
|
||||
typedef tvec3<float, mediump> mediump_vec3;
|
||||
|
||||
/// 3 components vector of low single-precision floating-point numbers.
|
||||
/// There is no guarantee on the actual precision.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.5 Vectors</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
|
||||
typedef detail::tvec3<float, lowp> lowp_vec3;
|
||||
|
||||
typedef tvec3<float, lowp> lowp_vec3;
|
||||
|
||||
/// 3 components vector of high double-precision floating-point numbers.
|
||||
/// There is no guarantee on the actual precision.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.5 Vectors</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
|
||||
typedef detail::tvec3<double, highp> highp_dvec3;
|
||||
|
||||
typedef tvec3<double, highp> highp_dvec3;
|
||||
|
||||
/// 3 components vector of medium double-precision floating-point numbers.
|
||||
/// There is no guarantee on the actual precision.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.5 Vectors</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
|
||||
typedef detail::tvec3<double, mediump> mediump_dvec3;
|
||||
|
||||
typedef tvec3<double, mediump> mediump_dvec3;
|
||||
|
||||
/// 3 components vector of low double-precision floating-point numbers.
|
||||
/// There is no guarantee on the actual precision.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.5 Vectors</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
|
||||
typedef detail::tvec3<double, lowp> lowp_dvec3;
|
||||
|
||||
typedef tvec3<double, lowp> lowp_dvec3;
|
||||
|
||||
/// 3 components vector of high precision signed integer numbers.
|
||||
/// There is no guarantee on the actual precision.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.5 Vectors</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
|
||||
typedef detail::tvec3<int, highp> highp_ivec3;
|
||||
|
||||
typedef tvec3<int, highp> highp_ivec3;
|
||||
|
||||
/// 3 components vector of medium precision signed integer numbers.
|
||||
/// There is no guarantee on the actual precision.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.5 Vectors</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
|
||||
typedef detail::tvec3<int, mediump> mediump_ivec3;
|
||||
|
||||
typedef tvec3<int, mediump> mediump_ivec3;
|
||||
|
||||
/// 3 components vector of low precision signed integer numbers.
|
||||
/// There is no guarantee on the actual precision.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.5 Vectors</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
|
||||
typedef detail::tvec3<int, lowp> lowp_ivec3;
|
||||
|
||||
typedef tvec3<int, lowp> lowp_ivec3;
|
||||
|
||||
/// 3 components vector of high precision unsigned integer numbers.
|
||||
/// There is no guarantee on the actual precision.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.5 Vectors</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
|
||||
typedef detail::tvec3<uint, highp> highp_uvec3;
|
||||
|
||||
typedef tvec3<uint, highp> highp_uvec3;
|
||||
|
||||
/// 3 components vector of medium precision unsigned integer numbers.
|
||||
/// There is no guarantee on the actual precision.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.5 Vectors</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
|
||||
typedef detail::tvec3<uint, mediump> mediump_uvec3;
|
||||
|
||||
typedef tvec3<uint, mediump> mediump_uvec3;
|
||||
|
||||
/// 3 components vector of low precision unsigned integer numbers.
|
||||
/// There is no guarantee on the actual precision.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.5 Vectors</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
|
||||
typedef detail::tvec3<uint, lowp> lowp_uvec3;
|
||||
|
||||
typedef tvec3<uint, lowp> lowp_uvec3;
|
||||
|
||||
/// 3 components vector of high precision bool numbers.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.5 Vectors</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
|
||||
typedef detail::tvec3<bool, highp> highp_bvec3;
|
||||
|
||||
typedef tvec3<bool, highp> highp_bvec3;
|
||||
|
||||
/// 3 components vector of medium precision bool numbers.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.5 Vectors</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
|
||||
typedef detail::tvec3<bool, mediump> mediump_bvec3;
|
||||
|
||||
typedef tvec3<bool, mediump> mediump_bvec3;
|
||||
|
||||
/// 3 components vector of low precision bool numbers.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.5 Vectors</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
|
||||
typedef detail::tvec3<bool, lowp> lowp_bvec3;
|
||||
|
||||
typedef tvec3<bool, lowp> lowp_bvec3;
|
||||
|
||||
/// @}
|
||||
|
||||
|
||||
/// @addtogroup core_precision
|
||||
/// @{
|
||||
|
||||
@ -279,100 +283,100 @@ namespace detail
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.5 Vectors</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
|
||||
typedef detail::tvec4<float, highp> highp_vec4;
|
||||
|
||||
typedef tvec4<float, highp> highp_vec4;
|
||||
|
||||
/// 4 components vector of medium single-precision floating-point numbers.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.5 Vectors</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
|
||||
typedef detail::tvec4<float, mediump> mediump_vec4;
|
||||
|
||||
typedef tvec4<float, mediump> mediump_vec4;
|
||||
|
||||
/// 4 components vector of low single-precision floating-point numbers.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.5 Vectors</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
|
||||
typedef detail::tvec4<float, lowp> lowp_vec4;
|
||||
|
||||
typedef tvec4<float, lowp> lowp_vec4;
|
||||
|
||||
/// 4 components vector of high double-precision floating-point numbers.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.5 Vectors</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
|
||||
typedef detail::tvec4<double, highp> highp_dvec4;
|
||||
|
||||
typedef tvec4<double, highp> highp_dvec4;
|
||||
|
||||
/// 4 components vector of medium double-precision floating-point numbers.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.5 Vectors</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
|
||||
typedef detail::tvec4<double, mediump> mediump_dvec4;
|
||||
|
||||
typedef tvec4<double, mediump> mediump_dvec4;
|
||||
|
||||
/// 4 components vector of low double-precision floating-point numbers.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.5 Vectors</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
|
||||
typedef detail::tvec4<double, lowp> lowp_dvec4;
|
||||
|
||||
typedef tvec4<double, lowp> lowp_dvec4;
|
||||
|
||||
/// 4 components vector of high precision signed integer numbers.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.5 Vectors</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
|
||||
typedef detail::tvec4<int, highp> highp_ivec4;
|
||||
|
||||
typedef tvec4<int, highp> highp_ivec4;
|
||||
|
||||
/// 4 components vector of medium precision signed integer numbers.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.5 Vectors</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
|
||||
typedef detail::tvec4<int, mediump> mediump_ivec4;
|
||||
|
||||
typedef tvec4<int, mediump> mediump_ivec4;
|
||||
|
||||
/// 4 components vector of low precision signed integer numbers.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.5 Vectors</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
|
||||
typedef detail::tvec4<int, lowp> lowp_ivec4;
|
||||
|
||||
typedef tvec4<int, lowp> lowp_ivec4;
|
||||
|
||||
/// 4 components vector of high precision unsigned integer numbers.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.5 Vectors</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
|
||||
typedef detail::tvec4<uint, highp> highp_uvec4;
|
||||
|
||||
typedef tvec4<uint, highp> highp_uvec4;
|
||||
|
||||
/// 4 components vector of medium precision unsigned integer numbers.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.5 Vectors</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
|
||||
typedef detail::tvec4<uint, mediump> mediump_uvec4;
|
||||
|
||||
typedef tvec4<uint, mediump> mediump_uvec4;
|
||||
|
||||
/// 4 components vector of low precision unsigned integer numbers.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.5 Vectors</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
|
||||
typedef detail::tvec4<uint, lowp> lowp_uvec4;
|
||||
typedef tvec4<uint, lowp> lowp_uvec4;
|
||||
|
||||
/// 4 components vector of high precision bool numbers.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.5 Vectors</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
|
||||
typedef detail::tvec4<bool, highp> highp_bvec4;
|
||||
|
||||
typedef tvec4<bool, highp> highp_bvec4;
|
||||
|
||||
/// 4 components vector of medium precision bool numbers.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.5 Vectors</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
|
||||
typedef detail::tvec4<bool, mediump> mediump_bvec4;
|
||||
|
||||
typedef tvec4<bool, mediump> mediump_bvec4;
|
||||
|
||||
/// 4 components vector of low precision bool numbers.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.5 Vectors</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
|
||||
typedef detail::tvec4<bool, lowp> lowp_bvec4;
|
||||
|
||||
typedef tvec4<bool, lowp> lowp_bvec4;
|
||||
|
||||
/// @}
|
||||
|
||||
|
||||
/// @addtogroup core_types
|
||||
/// @{
|
||||
|
||||
|
||||
//////////////////////////
|
||||
// Default float definition
|
||||
|
||||
|
||||
#if(defined(GLM_PRECISION_LOWP_FLOAT))
|
||||
typedef lowp_vec2 vec2;
|
||||
typedef lowp_vec3 vec3;
|
||||
@ -386,12 +390,12 @@ namespace detail
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.5 Vectors</a>
|
||||
typedef highp_vec2 vec2;
|
||||
|
||||
|
||||
//! 3 components vector of floating-point numbers.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.5 Vectors</a>
|
||||
typedef highp_vec3 vec3;
|
||||
|
||||
|
||||
//! 4 components vector of floating-point numbers.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.5 Vectors</a>
|
||||
@ -400,7 +404,7 @@ namespace detail
|
||||
|
||||
//////////////////////////
|
||||
// Default double definition
|
||||
|
||||
|
||||
#if(defined(GLM_PRECISION_LOWP_DOUBLE))
|
||||
typedef lowp_dvec2 dvec2;
|
||||
typedef lowp_dvec3 dvec3;
|
||||
@ -512,5 +516,3 @@ namespace detail
|
||||
|
||||
/// @}
|
||||
}//namespace glm
|
||||
|
||||
#endif//glm_core_type_vec
|
||||
|
||||
@ -12,6 +12,10 @@
|
||||
/// 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
|
||||
@ -21,7 +25,7 @@
|
||||
/// THE SOFTWARE.
|
||||
///
|
||||
/// @ref core
|
||||
/// @file glm/core/type_vec.inl
|
||||
/// @file glm/detail/type_vec.inl
|
||||
/// @date 2011-06-15 / 2011-06-15
|
||||
/// @author Christophe Riccio
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@ -12,6 +12,10 @@
|
||||
/// 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
|
||||
@ -21,13 +25,12 @@
|
||||
/// THE SOFTWARE.
|
||||
///
|
||||
/// @ref core
|
||||
/// @file glm/core/type_vec1.hpp
|
||||
/// @file glm/detail/type_vec1.hpp
|
||||
/// @date 2008-08-25 / 2011-06-15
|
||||
/// @author Christophe Riccio
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef glm_core_type_gentype1
|
||||
#define glm_core_type_gentype1
|
||||
#pragma once
|
||||
|
||||
#include "../fwd.hpp"
|
||||
#include "type_vec.hpp"
|
||||
@ -40,59 +43,83 @@
|
||||
#endif //GLM_SWIZZLE
|
||||
#include <cstddef>
|
||||
|
||||
namespace glm{
|
||||
namespace detail
|
||||
namespace glm
|
||||
{
|
||||
template <typename T, precision P>
|
||||
template <typename T, precision P = defaultp>
|
||||
struct tvec1
|
||||
{
|
||||
//////////////////////////////////////
|
||||
// Implementation detail
|
||||
|
||||
enum ctor{_null};
|
||||
|
||||
typedef tvec1<T, P> type;
|
||||
typedef tvec1<bool, P> bool_type;
|
||||
typedef T value_type;
|
||||
|
||||
//////////////////////////////////////
|
||||
// Helper
|
||||
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const;
|
||||
|
||||
//////////////////////////////////////
|
||||
// Data
|
||||
|
||||
union {T x, r, s;};
|
||||
# if GLM_HAS_ANONYMOUS_UNION
|
||||
union
|
||||
{
|
||||
T x;
|
||||
T r;
|
||||
T s;
|
||||
/*
|
||||
# ifdef GLM_SWIZZLE
|
||||
_GLM_SWIZZLE1_2_MEMBERS(T, P, tvec2, x)
|
||||
_GLM_SWIZZLE1_2_MEMBERS(T, P, tvec2, r)
|
||||
_GLM_SWIZZLE1_2_MEMBERS(T, P, tvec2, s)
|
||||
_GLM_SWIZZLE1_3_MEMBERS(T, P, tvec3, x)
|
||||
_GLM_SWIZZLE1_3_MEMBERS(T, P, tvec3, r)
|
||||
_GLM_SWIZZLE1_3_MEMBERS(T, P, tvec3, s)
|
||||
_GLM_SWIZZLE1_4_MEMBERS(T, P, tvec4, x)
|
||||
_GLM_SWIZZLE1_4_MEMBERS(T, P, tvec4, r)
|
||||
_GLM_SWIZZLE1_4_MEMBERS(T, P, tvec4, s)
|
||||
# endif//GLM_SWIZZLE*/
|
||||
};
|
||||
# else
|
||||
union {T x, r, s;};
|
||||
/*
|
||||
# ifdef GLM_SWIZZLE
|
||||
GLM_SWIZZLE_GEN_VEC_FROM_VEC1(T, P, tvec2, tvec2, tvec3, tvec4)
|
||||
# endif//GLM_SWIZZLE*/
|
||||
# endif
|
||||
|
||||
//////////////////////////////////////
|
||||
// Accesses
|
||||
|
||||
GLM_FUNC_DECL T & operator[](length_t i);
|
||||
GLM_FUNC_DECL T const & operator[](length_t i) const;
|
||||
# ifdef GLM_FORCE_SIZE_FUNC
|
||||
/// Return the count of components of the vector
|
||||
typedef size_t size_type;
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR size_type size() const;
|
||||
|
||||
GLM_FUNC_DECL T & operator[](size_type i);
|
||||
GLM_FUNC_DECL T const & operator[](size_type i) const;
|
||||
# else
|
||||
/// Return the count of components of the vector
|
||||
typedef length_t length_type;
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR length_type length() const;
|
||||
|
||||
GLM_FUNC_DECL T & operator[](length_type i);
|
||||
GLM_FUNC_DECL T const & operator[](length_type i) const;
|
||||
# endif//GLM_FORCE_SIZE_FUNC
|
||||
|
||||
//////////////////////////////////////
|
||||
// Implicit basic constructors
|
||||
|
||||
GLM_FUNC_DECL tvec1();
|
||||
GLM_FUNC_DECL tvec1(tvec1<T, P> const & v);
|
||||
template <precision Q>
|
||||
GLM_FUNC_DECL tvec1(tvec1<T, Q> const & v);
|
||||
|
||||
//////////////////////////////////////
|
||||
// Explicit basic constructors
|
||||
|
||||
GLM_FUNC_DECL explicit tvec1(
|
||||
ctor);
|
||||
GLM_FUNC_DECL tvec1(
|
||||
T const & s);
|
||||
GLM_FUNC_DECL explicit tvec1(ctor);
|
||||
GLM_FUNC_DECL explicit tvec1(T const & s);
|
||||
|
||||
//////////////////////////////////////
|
||||
// Conversion vector constructors
|
||||
|
||||
//! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
|
||||
template <typename U, precision Q>
|
||||
GLM_FUNC_DECL explicit tvec1(tvec1<U, Q> const & v);
|
||||
//! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
|
||||
template <typename U, precision Q>
|
||||
GLM_FUNC_DECL explicit tvec1(tvec2<U, Q> const & v);
|
||||
@ -103,13 +130,32 @@ namespace detail
|
||||
template <typename U, precision Q>
|
||||
GLM_FUNC_DECL explicit tvec1(tvec4<U, Q> const & v);
|
||||
|
||||
# ifdef GLM_FORCE_EXPLICIT_CTOR
|
||||
//! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
|
||||
template <typename U, precision Q>
|
||||
GLM_FUNC_DECL explicit tvec1(tvec1<U, Q> const & v);
|
||||
# else
|
||||
//! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
|
||||
template <typename U, precision Q>
|
||||
GLM_FUNC_DECL tvec1(tvec1<U, Q> const & v);
|
||||
# endif
|
||||
|
||||
//////////////////////////////////////
|
||||
// Swizzle constructors
|
||||
|
||||
# if(GLM_HAS_ANONYMOUS_UNION && defined(GLM_SWIZZLE))
|
||||
template <int E0>
|
||||
GLM_FUNC_DECL tvec1(detail::_swizzle<1, T, P, tvec1<T, P>, E0, -1,-2,-3> const & that)
|
||||
{
|
||||
*this = that();
|
||||
}
|
||||
# endif//(GLM_HAS_ANONYMOUS_UNION && defined(GLM_SWIZZLE))
|
||||
|
||||
//////////////////////////////////////
|
||||
// Unary arithmetic operators
|
||||
|
||||
GLM_FUNC_DECL tvec1<T, P> & operator= (tvec1<T, P> const & v);
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tvec1<T, P> & operator= (tvec1<U, P> const & v);
|
||||
|
||||
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);
|
||||
template <typename U>
|
||||
@ -266,12 +312,8 @@ namespace detail
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tvec1<T, P> operator~(tvec1<T, P> const & v);
|
||||
|
||||
}//namespace detail
|
||||
}//namespace glm
|
||||
|
||||
#ifndef GLM_EXTERNAL_TEMPLATE
|
||||
#include "type_vec1.inl"
|
||||
#endif//GLM_EXTERNAL_TEMPLATE
|
||||
|
||||
#endif//glm_core_type_gentype1
|
||||
|
||||
@ -12,6 +12,10 @@
|
||||
/// 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
|
||||
@ -21,54 +25,27 @@
|
||||
/// THE SOFTWARE.
|
||||
///
|
||||
/// @ref core
|
||||
/// @file glm/core/type_vec1.inl
|
||||
/// @file glm/detail/type_vec1.inl
|
||||
/// @date 2008-08-25 / 2011-06-15
|
||||
/// @author Christophe Riccio
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
namespace glm{
|
||||
namespace detail
|
||||
namespace glm
|
||||
{
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR length_t tvec1<T, P>::length() const
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
//////////////////////////////////////
|
||||
// Accesses
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER T & tvec1<T, P>::operator[](length_t i)
|
||||
{
|
||||
assert(i >= 0 && i < this->length());
|
||||
return (&x)[i];
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER T const & tvec1<T, P>::operator[](length_t i) const
|
||||
{
|
||||
assert(i >= 0 && i < this->length());
|
||||
return (&x)[i];
|
||||
}
|
||||
|
||||
//////////////////////////////////////
|
||||
// Implicit basic constructors
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tvec1<T, P>::tvec1() :
|
||||
x(static_cast<T>(0))
|
||||
{}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tvec1<T, P>::tvec1(tvec1<T, P> const & v) :
|
||||
x(v.x)
|
||||
GLM_FUNC_QUALIFIER tvec1<T, P>::tvec1()
|
||||
# ifndef GLM_FORCE_NO_CTOR_INIT
|
||||
: x(0)
|
||||
# endif
|
||||
{}
|
||||
|
||||
template <typename T, precision P>
|
||||
template <precision Q>
|
||||
GLM_FUNC_QUALIFIER tvec1<T, P>::tvec1(tvec1<T, Q> const & v) :
|
||||
x(v.x)
|
||||
GLM_FUNC_QUALIFIER tvec1<T, P>::tvec1(tvec1<T, Q> const & v)
|
||||
: x(v.x)
|
||||
{}
|
||||
|
||||
//////////////////////////////////////
|
||||
@ -79,8 +56,8 @@ namespace detail
|
||||
{}
|
||||
|
||||
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 & s)
|
||||
: x(s)
|
||||
{}
|
||||
|
||||
//////////////////////////////////////
|
||||
@ -88,59 +65,79 @@ namespace detail
|
||||
|
||||
template <typename T, precision P>
|
||||
template <typename U, precision Q>
|
||||
GLM_FUNC_QUALIFIER tvec1<T, P>::tvec1
|
||||
(
|
||||
tvec1<U, Q> const & v
|
||||
) :
|
||||
x(static_cast<T>(v.x))
|
||||
GLM_FUNC_QUALIFIER tvec1<T, P>::tvec1(tvec1<U, Q> const & v)
|
||||
: x(static_cast<T>(v.x))
|
||||
{}
|
||||
|
||||
template <typename T, precision P>
|
||||
template <typename U, precision Q>
|
||||
GLM_FUNC_QUALIFIER tvec1<T, P>::tvec1
|
||||
(
|
||||
tvec2<U, Q> const & v
|
||||
) :
|
||||
x(static_cast<T>(v.x))
|
||||
GLM_FUNC_QUALIFIER tvec1<T, P>::tvec1(tvec2<U, Q> const & v)
|
||||
: x(static_cast<T>(v.x))
|
||||
{}
|
||||
|
||||
template <typename T, precision P>
|
||||
template <typename U, precision Q>
|
||||
GLM_FUNC_QUALIFIER tvec1<T, P>::tvec1
|
||||
(
|
||||
tvec3<U, Q> const & v
|
||||
) :
|
||||
x(static_cast<T>(v.x))
|
||||
GLM_FUNC_QUALIFIER tvec1<T, P>::tvec1(tvec3<U, Q> const & v)
|
||||
: x(static_cast<T>(v.x))
|
||||
{}
|
||||
|
||||
template <typename T, precision P>
|
||||
template <typename U, precision Q>
|
||||
GLM_FUNC_QUALIFIER tvec1<T, P>::tvec1
|
||||
(
|
||||
tvec4<U, Q> const & v
|
||||
) :
|
||||
x(static_cast<T>(v.x))
|
||||
GLM_FUNC_QUALIFIER tvec1<T, P>::tvec1(tvec4<U, Q> const & v)
|
||||
: x(static_cast<T>(v.x))
|
||||
{}
|
||||
|
||||
//////////////////////////////////////
|
||||
// Component accesses
|
||||
|
||||
# ifdef GLM_FORCE_SIZE_FUNC
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tvec1<T, P>::size_type tvec1<T, P>::size() const
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER T & tvec1<T, P>::operator[](typename tvec1<T, P>::size_type i)
|
||||
{
|
||||
assert(i >= 0 && static_cast<detail::component_count_t>(i) < detail::component_count(*this));
|
||||
return (&x)[i];
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER T const & tvec1<T, P>::operator[](typename tvec1<T, P>::size_type i) const
|
||||
{
|
||||
assert(i >= 0 && static_cast<detail::component_count_t>(i) < detail::component_count(*this));
|
||||
return (&x)[i];
|
||||
}
|
||||
# else
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tvec1<T, P>::length_type tvec1<T, P>::length() const
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER T & tvec1<T, P>::operator[](typename tvec1<T, P>::length_type i)
|
||||
{
|
||||
assert(i >= 0 && static_cast<detail::component_count_t>(i) < detail::component_count(*this));
|
||||
return (&x)[i];
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER T const & tvec1<T, P>::operator[](typename tvec1<T, P>::length_type i) const
|
||||
{
|
||||
assert(i >= 0 && static_cast<detail::component_count_t>(i) < detail::component_count(*this));
|
||||
return (&x)[i];
|
||||
}
|
||||
# endif//GLM_FORCE_SIZE_FUNC
|
||||
|
||||
//////////////////////////////////////
|
||||
// Unary arithmetic operators
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tvec1<T, P> & tvec1<T, P>::operator=
|
||||
(
|
||||
tvec1<T, P> const & v
|
||||
)
|
||||
{
|
||||
this->x = v.x;
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
template <typename U>
|
||||
GLM_FUNC_QUALIFIER tvec1<T, P> & tvec1<T, P>::operator=
|
||||
(
|
||||
tvec1<U, P> const & v
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tvec1<T, P> & tvec1<T, P>::operator=(tvec1<U, P> const & v)
|
||||
{
|
||||
this->x = static_cast<T>(v.x);
|
||||
return *this;
|
||||
@ -148,10 +145,7 @@ namespace detail
|
||||
|
||||
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 & s)
|
||||
{
|
||||
this->x += static_cast<T>(s);
|
||||
return *this;
|
||||
@ -159,10 +153,7 @@ namespace detail
|
||||
|
||||
template <typename T, precision P>
|
||||
template <typename U>
|
||||
GLM_FUNC_QUALIFIER tvec1<T, P> & tvec1<T, P>::operator+=
|
||||
(
|
||||
tvec1<U, P> const & v
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tvec1<T, P> & tvec1<T, P>::operator+=(tvec1<U, P> const & v)
|
||||
{
|
||||
this->x += static_cast<T>(v.x);
|
||||
return *this;
|
||||
@ -170,10 +161,7 @@ namespace detail
|
||||
|
||||
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 & s)
|
||||
{
|
||||
this->x -= static_cast<T>(s);
|
||||
return *this;
|
||||
@ -181,10 +169,7 @@ namespace detail
|
||||
|
||||
template <typename T, precision P>
|
||||
template <typename U>
|
||||
GLM_FUNC_QUALIFIER tvec1<T, P> & tvec1<T, P>::operator-=
|
||||
(
|
||||
tvec1<U, P> const & v
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tvec1<T, P> & tvec1<T, P>::operator-=(tvec1<U, P> const & v)
|
||||
{
|
||||
this->x -= static_cast<T>(v.x);
|
||||
return *this;
|
||||
@ -192,10 +177,7 @@ namespace detail
|
||||
|
||||
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 & s)
|
||||
{
|
||||
this->x *= static_cast<T>(s);
|
||||
return *this;
|
||||
@ -203,10 +185,7 @@ namespace detail
|
||||
|
||||
template <typename T, precision P>
|
||||
template <typename U>
|
||||
GLM_FUNC_QUALIFIER tvec1<T, P> & tvec1<T, P>::operator*=
|
||||
(
|
||||
tvec1<U, P> const & v
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tvec1<T, P> & tvec1<T, P>::operator*=(tvec1<U, P> const & v)
|
||||
{
|
||||
this->x *= static_cast<T>(v.x);
|
||||
return *this;
|
||||
@ -214,10 +193,7 @@ namespace detail
|
||||
|
||||
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 & s)
|
||||
{
|
||||
this->x /= static_cast<T>(s);
|
||||
return *this;
|
||||
@ -225,10 +201,7 @@ namespace detail
|
||||
|
||||
template <typename T, precision P>
|
||||
template <typename U>
|
||||
GLM_FUNC_QUALIFIER tvec1<T, P> & tvec1<T, P>::operator/=
|
||||
(
|
||||
tvec1<U, P> const & v
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tvec1<T, P> & tvec1<T, P>::operator/=(tvec1<U, P> const & v)
|
||||
{
|
||||
this->x /= static_cast<T>(v.x);
|
||||
return *this;
|
||||
@ -271,21 +244,13 @@ namespace detail
|
||||
// Boolean operators
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER bool operator==
|
||||
(
|
||||
tvec1<T, P> const & v1,
|
||||
tvec1<T, P> const & v2
|
||||
)
|
||||
GLM_FUNC_QUALIFIER bool operator==(tvec1<T, P> const & v1, tvec1<T, P> const & v2)
|
||||
{
|
||||
return (v1.x == v2.x);
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER bool operator!=
|
||||
(
|
||||
tvec1<T, P> const & v1,
|
||||
tvec1<T, P> const & v2
|
||||
)
|
||||
GLM_FUNC_QUALIFIER bool operator!=(tvec1<T, P> const & v1, tvec1<T, P> const & v2)
|
||||
{
|
||||
return (v1.x != v2.x);
|
||||
}
|
||||
@ -295,10 +260,7 @@ namespace detail
|
||||
|
||||
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 & s)
|
||||
{
|
||||
this->x %= static_cast<T>(s);
|
||||
return *this;
|
||||
@ -306,10 +268,7 @@ namespace detail
|
||||
|
||||
template <typename T, precision P>
|
||||
template <typename U>
|
||||
GLM_FUNC_QUALIFIER tvec1<T, P> & tvec1<T, P>::operator%=
|
||||
(
|
||||
tvec1<U, P> const & v
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tvec1<T, P> & tvec1<T, P>::operator%=(tvec1<U, P> const & v)
|
||||
{
|
||||
this->x %= static_cast<T>(v.x);
|
||||
return *this;
|
||||
@ -317,10 +276,7 @@ namespace detail
|
||||
|
||||
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 & s)
|
||||
{
|
||||
this->x &= static_cast<T>(s);
|
||||
return *this;
|
||||
@ -328,10 +284,7 @@ namespace detail
|
||||
|
||||
template <typename T, precision P>
|
||||
template <typename U>
|
||||
GLM_FUNC_QUALIFIER tvec1<T, P> & tvec1<T, P>::operator&=
|
||||
(
|
||||
tvec1<U, P> const & v
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tvec1<T, P> & tvec1<T, P>::operator&=(tvec1<U, P> const & v)
|
||||
{
|
||||
this->x &= static_cast<T>(v.x);
|
||||
return *this;
|
||||
@ -339,10 +292,7 @@ namespace detail
|
||||
|
||||
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 & s)
|
||||
{
|
||||
this->x |= static_cast<T>(s);
|
||||
return *this;
|
||||
@ -350,10 +300,7 @@ namespace detail
|
||||
|
||||
template <typename T, precision P>
|
||||
template <typename U>
|
||||
GLM_FUNC_QUALIFIER tvec1<T, P> & tvec1<T, P>::operator|=
|
||||
(
|
||||
tvec1<U, P> const & v
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tvec1<T, P> & tvec1<T, P>::operator|=(tvec1<U, P> const & v)
|
||||
{
|
||||
this->x |= U(v.x);
|
||||
return *this;
|
||||
@ -361,10 +308,7 @@ namespace detail
|
||||
|
||||
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 & s)
|
||||
{
|
||||
this->x ^= static_cast<T>(s);
|
||||
return *this;
|
||||
@ -372,10 +316,7 @@ namespace detail
|
||||
|
||||
template <typename T, precision P>
|
||||
template <typename U>
|
||||
GLM_FUNC_QUALIFIER tvec1<T, P> & tvec1<T, P>::operator^=
|
||||
(
|
||||
tvec1<U, P> const & v
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tvec1<T, P> & tvec1<T, P>::operator^=(tvec1<U, P> const & v)
|
||||
{
|
||||
this->x ^= static_cast<T>(v.x);
|
||||
return *this;
|
||||
@ -383,10 +324,7 @@ namespace detail
|
||||
|
||||
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 & s)
|
||||
{
|
||||
this->x <<= static_cast<T>(s);
|
||||
return *this;
|
||||
@ -394,10 +332,7 @@ namespace detail
|
||||
|
||||
template <typename T, precision P>
|
||||
template <typename U>
|
||||
GLM_FUNC_QUALIFIER tvec1<T, P> & tvec1<T, P>::operator<<=
|
||||
(
|
||||
tvec1<U, P> const & v
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tvec1<T, P> & tvec1<T, P>::operator<<=(tvec1<U, P> const & v)
|
||||
{
|
||||
this->x <<= static_cast<T>(v.x);
|
||||
return *this;
|
||||
@ -405,10 +340,7 @@ namespace detail
|
||||
|
||||
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 & s)
|
||||
{
|
||||
this->x >>= static_cast<T>(s);
|
||||
return *this;
|
||||
@ -416,10 +348,7 @@ namespace detail
|
||||
|
||||
template <typename T, precision P>
|
||||
template <typename U>
|
||||
GLM_FUNC_QUALIFIER tvec1<T, P> & tvec1<T, P>::operator>>=
|
||||
(
|
||||
tvec1<U, P> const & v
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tvec1<T, P> & tvec1<T, P>::operator>>=(tvec1<U, P> const & v)
|
||||
{
|
||||
this->x >>= static_cast<T>(v.x);
|
||||
return *this;
|
||||
@ -429,33 +358,21 @@ namespace detail
|
||||
// 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 & s)
|
||||
{
|
||||
return tvec1<T, P>(
|
||||
v.x + s);
|
||||
}
|
||||
|
||||
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 & s, tvec1<T, P> const & v)
|
||||
{
|
||||
return tvec1<T, P>(
|
||||
s + v.x);
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tvec1<T, P> operator+
|
||||
(
|
||||
tvec1<T, P> const & v1,
|
||||
tvec1<T, P> const & v2
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tvec1<T, P> operator+(tvec1<T, P> const & v1, tvec1<T, P> const & v2)
|
||||
{
|
||||
return tvec1<T, P>(
|
||||
v1.x + v2.x);
|
||||
@ -463,33 +380,21 @@ namespace detail
|
||||
|
||||
//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 & s)
|
||||
{
|
||||
return tvec1<T, P>(
|
||||
v.x - s);
|
||||
}
|
||||
|
||||
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 & s, tvec1<T, P> const & v)
|
||||
{
|
||||
return tvec1<T, P>(
|
||||
s - v.x);
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tvec1<T, P> operator-
|
||||
(
|
||||
tvec1<T, P> const & v1,
|
||||
tvec1<T, P> const & v2
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tvec1<T, P> operator-(tvec1<T, P> const & v1, tvec1<T, P> const & v2)
|
||||
{
|
||||
return tvec1<T, P>(
|
||||
v1.x - v2.x);
|
||||
@ -497,33 +402,21 @@ namespace detail
|
||||
|
||||
//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 & s)
|
||||
{
|
||||
return tvec1<T, P>(
|
||||
v.x * s);
|
||||
}
|
||||
|
||||
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 & s, tvec1<T, P> const & v)
|
||||
{
|
||||
return tvec1<T, P>(
|
||||
s * v.x);
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tvec1<T, P> operator*
|
||||
(
|
||||
tvec1<T, P> const & v1,
|
||||
tvec1<T, P> const & v2
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tvec1<T, P> operator*(tvec1<T, P> const & v1, tvec1<T, P> const & v2)
|
||||
{
|
||||
return tvec1<T, P>(
|
||||
v1.x * v2.x);
|
||||
@ -531,33 +424,21 @@ namespace detail
|
||||
|
||||
//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 & s)
|
||||
{
|
||||
return tvec1<T, P>(
|
||||
v.x / s);
|
||||
}
|
||||
|
||||
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 & s, tvec1<T, P> const & v)
|
||||
{
|
||||
return tvec1<T, P>(
|
||||
s / v.x);
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tvec1<T, P> operator/
|
||||
(
|
||||
tvec1<T, P> const & v1,
|
||||
tvec1<T, P> const & v2
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tvec1<T, P> operator/(tvec1<T, P> const & v1, tvec1<T, P> const & v2)
|
||||
{
|
||||
return tvec1<T, P>(
|
||||
v1.x / v2.x);
|
||||
@ -565,32 +446,21 @@ namespace detail
|
||||
|
||||
// Unary constant operators
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tvec1<T, P> operator-
|
||||
(
|
||||
tvec1<T, P> const & v
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tvec1<T, P> operator-(tvec1<T, P> const & v)
|
||||
{
|
||||
return tvec1<T, P>(
|
||||
-v.x);
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tvec1<T, P> operator++
|
||||
(
|
||||
tvec1<T, P> const & v,
|
||||
int
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tvec1<T, P> operator++(tvec1<T, P> const & v, int)
|
||||
{
|
||||
return tvec1<T, P>(
|
||||
v.x + T(1));
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tvec1<T, P> operator--
|
||||
(
|
||||
tvec1<T, P> const & v,
|
||||
int
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tvec1<T, P> operator--(tvec1<T, P> const & v, int)
|
||||
{
|
||||
return tvec1<T, P>(
|
||||
v.x - T(1));
|
||||
@ -600,212 +470,135 @@ namespace detail
|
||||
// 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 & s)
|
||||
{
|
||||
return tvec1<T, P>(
|
||||
v.x % s);
|
||||
}
|
||||
|
||||
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 & s, tvec1<T, P> const & v)
|
||||
{
|
||||
return tvec1<T, P>(
|
||||
s % v.x);
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tvec1<T, P> operator%
|
||||
(
|
||||
tvec1<T, P> const & v1,
|
||||
tvec1<T, P> const & v2
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tvec1<T, P> operator%(tvec1<T, P> const & v1, tvec1<T, P> const & v2)
|
||||
{
|
||||
return tvec1<T, P>(
|
||||
v1.x % v2.x);
|
||||
}
|
||||
|
||||
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 & s)
|
||||
{
|
||||
return tvec1<T, P>(
|
||||
v.x & s);
|
||||
}
|
||||
|
||||
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 & s, tvec1<T, P> const & v)
|
||||
{
|
||||
return tvec1<T, P>(
|
||||
s & v.x);
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tvec1<T, P> operator&
|
||||
(
|
||||
tvec1<T, P> const & v1,
|
||||
tvec1<T, P> const & v2
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tvec1<T, P> operator&(tvec1<T, P> const & v1, tvec1<T, P> const & v2)
|
||||
{
|
||||
return tvec1<T, P>(
|
||||
v1.x & v2.x);
|
||||
}
|
||||
|
||||
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 & s)
|
||||
{
|
||||
return tvec1<T, P>(
|
||||
v.x | s);
|
||||
}
|
||||
|
||||
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 & s, tvec1<T, P> const & v)
|
||||
{
|
||||
return tvec1<T, P>(
|
||||
s | v.x);
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tvec1<T, P> operator|
|
||||
(
|
||||
tvec1<T, P> const & v1,
|
||||
tvec1<T, P> const & v2
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tvec1<T, P> operator|(tvec1<T, P> const & v1, tvec1<T, P> const & v2)
|
||||
{
|
||||
return tvec1<T, P>(
|
||||
v1.x | v2.x);
|
||||
}
|
||||
|
||||
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 & s)
|
||||
{
|
||||
return tvec1<T, P>(
|
||||
v.x ^ s);
|
||||
}
|
||||
|
||||
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 & s, tvec1<T, P> const & v)
|
||||
{
|
||||
return tvec1<T, P>(
|
||||
s ^ v.x);
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tvec1<T, P> operator^
|
||||
(
|
||||
tvec1<T, P> const & v1,
|
||||
tvec1<T, P> const & v2
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tvec1<T, P> operator^(tvec1<T, P> const & v1, tvec1<T, P> const & v2)
|
||||
{
|
||||
return tvec1<T, P>(
|
||||
v1.x ^ v2.x);
|
||||
}
|
||||
|
||||
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 & s)
|
||||
{
|
||||
return tvec1<T, P>(
|
||||
v.x << s);
|
||||
}
|
||||
|
||||
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 & s, tvec1<T, P> const & v)
|
||||
{
|
||||
return tvec1<T, P>(
|
||||
s << v.x);
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tvec1<T, P> operator<<
|
||||
(
|
||||
tvec1<T, P> const & v1,
|
||||
tvec1<T, P> const & v2
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tvec1<T, P> operator<<(tvec1<T, P> const & v1, tvec1<T, P> const & v2)
|
||||
{
|
||||
return tvec1<T, P>(
|
||||
v1.x << v2.x);
|
||||
}
|
||||
|
||||
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 & s)
|
||||
{
|
||||
return tvec1<T, P>(
|
||||
v.x >> s);
|
||||
}
|
||||
|
||||
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 & s, tvec1<T, P> const & v)
|
||||
{
|
||||
return tvec1<T, P>(
|
||||
s >> v.x);
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tvec1<T, P> operator>>
|
||||
(
|
||||
tvec1<T, P> const & v1,
|
||||
tvec1<T, P> const & v2
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tvec1<T, P> operator>>(tvec1<T, P> const & v1, tvec1<T, P> const & v2)
|
||||
{
|
||||
return tvec1<T, P>(
|
||||
v1.x >> v2.x);
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tvec1<T, P> operator~
|
||||
(
|
||||
tvec1<T, P> const & v
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tvec1<T, P> operator~(tvec1<T, P> const & v)
|
||||
{
|
||||
return tvec1<T, P>(
|
||||
~v.x);
|
||||
}
|
||||
|
||||
}//namespace detail
|
||||
}//namespace glm
|
||||
|
||||
@ -12,6 +12,10 @@
|
||||
/// 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
|
||||
@ -21,13 +25,12 @@
|
||||
/// THE SOFTWARE.
|
||||
///
|
||||
/// @ref core
|
||||
/// @file glm/core/type_vec2.hpp
|
||||
/// @file glm/detail/type_vec2.hpp
|
||||
/// @date 2008-08-18 / 2013-08-27
|
||||
/// @author Christophe Riccio
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef glm_core_type_gentype2
|
||||
#define glm_core_type_gentype2
|
||||
#pragma once
|
||||
|
||||
//#include "../fwd.hpp"
|
||||
#include "type_vec.hpp"
|
||||
@ -40,107 +43,94 @@
|
||||
#endif //GLM_SWIZZLE
|
||||
#include <cstddef>
|
||||
|
||||
namespace glm{
|
||||
namespace detail
|
||||
namespace glm
|
||||
{
|
||||
template <typename T, precision P>
|
||||
template <typename T, precision P = defaultp>
|
||||
struct tvec2
|
||||
{
|
||||
//////////////////////////////////////
|
||||
// Implementation detail
|
||||
|
||||
enum ctor{_null};
|
||||
|
||||
typedef tvec2<T, P> type;
|
||||
typedef tvec2<bool, P> bool_type;
|
||||
typedef T value_type;
|
||||
typedef int size_type;
|
||||
|
||||
//////////////////////////////////////
|
||||
// Helper
|
||||
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const;
|
||||
|
||||
//////////////////////////////////////
|
||||
// Data
|
||||
|
||||
# if(GLM_HAS_ANONYMOUS_UNION && defined(GLM_SWIZZLE))
|
||||
# if GLM_HAS_ANONYMOUS_UNION
|
||||
union
|
||||
{
|
||||
struct{ T x, y; };
|
||||
struct{ T r, g; };
|
||||
struct{ T s, t; };
|
||||
|
||||
_GLM_SWIZZLE2_2_MEMBERS(T, P, tvec2, x, y)
|
||||
_GLM_SWIZZLE2_2_MEMBERS(T, P, tvec2, r, g)
|
||||
_GLM_SWIZZLE2_2_MEMBERS(T, P, tvec2, s, t)
|
||||
_GLM_SWIZZLE2_3_MEMBERS(T, P, tvec3, x, y)
|
||||
_GLM_SWIZZLE2_3_MEMBERS(T, P, tvec3, r, g)
|
||||
_GLM_SWIZZLE2_3_MEMBERS(T, P, tvec3, s, t)
|
||||
_GLM_SWIZZLE2_4_MEMBERS(T, P, tvec4, x, y)
|
||||
_GLM_SWIZZLE2_4_MEMBERS(T, P, tvec4, r, g)
|
||||
_GLM_SWIZZLE2_4_MEMBERS(T, P, tvec4, s, t)
|
||||
# ifdef GLM_SWIZZLE
|
||||
_GLM_SWIZZLE2_2_MEMBERS(T, P, tvec2, x, y)
|
||||
_GLM_SWIZZLE2_2_MEMBERS(T, P, tvec2, r, g)
|
||||
_GLM_SWIZZLE2_2_MEMBERS(T, P, tvec2, s, t)
|
||||
_GLM_SWIZZLE2_3_MEMBERS(T, P, tvec3, x, y)
|
||||
_GLM_SWIZZLE2_3_MEMBERS(T, P, tvec3, r, g)
|
||||
_GLM_SWIZZLE2_3_MEMBERS(T, P, tvec3, s, t)
|
||||
_GLM_SWIZZLE2_4_MEMBERS(T, P, tvec4, x, y)
|
||||
_GLM_SWIZZLE2_4_MEMBERS(T, P, tvec4, r, g)
|
||||
_GLM_SWIZZLE2_4_MEMBERS(T, P, tvec4, s, t)
|
||||
# endif//GLM_SWIZZLE
|
||||
};
|
||||
# else
|
||||
union {T x, r, s;};
|
||||
union {T y, g, t;};
|
||||
|
||||
# ifdef GLM_SWIZZLE
|
||||
GLM_SWIZZLE_GEN_VEC_FROM_VEC2(T, P, detail::tvec2, detail::tvec2, detail::tvec3, detail::tvec4)
|
||||
# endif
|
||||
GLM_SWIZZLE_GEN_VEC_FROM_VEC2(T, P, tvec2, tvec2, tvec3, tvec4)
|
||||
# endif//GLM_SWIZZLE
|
||||
# endif
|
||||
|
||||
//////////////////////////////////////
|
||||
// Accesses
|
||||
// Component accesses
|
||||
|
||||
GLM_FUNC_DECL T & operator[](length_t i);
|
||||
GLM_FUNC_DECL T const & operator[](length_t i) const;
|
||||
# ifdef GLM_FORCE_SIZE_FUNC
|
||||
/// Return the count of components of the vector
|
||||
typedef size_t size_type;
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR size_type size() const;
|
||||
|
||||
GLM_FUNC_DECL T & operator[](size_type i);
|
||||
GLM_FUNC_DECL T const & operator[](size_type i) const;
|
||||
# else
|
||||
/// Return the count of components of the vector
|
||||
typedef length_t length_type;
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR length_type length() const;
|
||||
|
||||
GLM_FUNC_DECL T & operator[](length_type i);
|
||||
GLM_FUNC_DECL T const & operator[](length_type i) const;
|
||||
# endif//GLM_FORCE_SIZE_FUNC
|
||||
|
||||
//////////////////////////////////////
|
||||
// Implicit basic constructors
|
||||
|
||||
GLM_FUNC_DECL tvec2();
|
||||
GLM_FUNC_DECL tvec2(tvec2<T, P> const & v);
|
||||
template <precision Q>
|
||||
GLM_FUNC_DECL tvec2(tvec2<T, Q> const & v);
|
||||
|
||||
//////////////////////////////////////
|
||||
// Explicit basic constructors
|
||||
|
||||
GLM_FUNC_DECL explicit tvec2(
|
||||
ctor);
|
||||
GLM_FUNC_DECL explicit tvec2(
|
||||
T const & s);
|
||||
GLM_FUNC_DECL tvec2(
|
||||
T const & s1,
|
||||
T const & s2);
|
||||
|
||||
//////////////////////////////////////
|
||||
// Swizzle constructors
|
||||
|
||||
# if(GLM_HAS_ANONYMOUS_UNION && defined(GLM_SWIZZLE))
|
||||
template <int E0, int E1>
|
||||
GLM_FUNC_DECL tvec2(_swizzle<2,T, P, tvec2<T, P>, E0, E1,-1,-2> const & that)
|
||||
{
|
||||
*this = that();
|
||||
}
|
||||
# endif//(GLM_HAS_ANONYMOUS_UNION && defined(GLM_SWIZZLE))
|
||||
GLM_FUNC_DECL explicit tvec2(ctor);
|
||||
GLM_FUNC_DECL explicit tvec2(T const & s);
|
||||
GLM_FUNC_DECL tvec2(T const & s1, T const & s2);
|
||||
|
||||
//////////////////////////////////////
|
||||
// Conversion constructors
|
||||
|
||||
//! Explicit converions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
|
||||
template <typename U, typename V>
|
||||
GLM_FUNC_DECL tvec2(
|
||||
U const & x,
|
||||
V const & y);
|
||||
/// Explicit converions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
|
||||
template <typename A, typename B>
|
||||
GLM_FUNC_DECL tvec2(A const & x, B const & y);
|
||||
template <typename A, typename B>
|
||||
GLM_FUNC_DECL tvec2(tvec1<A, P> const & v1, tvec1<B, P> const & v2);
|
||||
|
||||
//////////////////////////////////////
|
||||
// Conversion vector constructors
|
||||
|
||||
//! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
|
||||
template <typename U, precision Q>
|
||||
GLM_FUNC_DECL tvec2(tvec2<U, Q> const & v);
|
||||
//! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
|
||||
template <typename U, precision Q>
|
||||
GLM_FUNC_DECL explicit tvec2(tvec3<U, Q> const & v);
|
||||
@ -148,28 +138,55 @@ namespace detail
|
||||
template <typename U, precision Q>
|
||||
GLM_FUNC_DECL explicit tvec2(tvec4<U, Q> const & v);
|
||||
|
||||
# ifdef GLM_FORCE_EXPLICIT_CTOR
|
||||
//! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
|
||||
template <typename U, precision Q>
|
||||
GLM_FUNC_DECL explicit tvec2(tvec2<U, Q> const & v);
|
||||
# else
|
||||
//! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
|
||||
template <typename U, precision Q>
|
||||
GLM_FUNC_DECL tvec2(tvec2<U, Q> const & v);
|
||||
# endif
|
||||
|
||||
//////////////////////////////////////
|
||||
// Swizzle constructors
|
||||
|
||||
# if GLM_HAS_ANONYMOUS_UNION && defined(GLM_SWIZZLE)
|
||||
template <int E0, int E1>
|
||||
GLM_FUNC_DECL tvec2(detail::_swizzle<2, T, P, tvec2<T, P>, E0, E1,-1,-2> const & that)
|
||||
{
|
||||
*this = that();
|
||||
}
|
||||
# endif// GLM_HAS_ANONYMOUS_UNION && defined(GLM_SWIZZLE)
|
||||
|
||||
//////////////////////////////////////
|
||||
// Unary arithmetic operators
|
||||
|
||||
GLM_FUNC_DECL tvec2<T, P> & operator= (tvec2<T, P> const & v);
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tvec2<T, P> & operator= (tvec2<U, P> const & v);
|
||||
|
||||
template <typename U>
|
||||
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);
|
||||
template <typename U>
|
||||
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>
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tvec2<T, P> & operator-=(U s);
|
||||
template <typename U>
|
||||
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>
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tvec2<T, P> & operator*=(U s);
|
||||
template <typename U>
|
||||
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>
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tvec2<T, P> & operator/=(U s);
|
||||
template <typename U>
|
||||
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);
|
||||
|
||||
//////////////////////////////////////
|
||||
@ -186,62 +203,98 @@ namespace detail
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tvec2<T, P> & operator%= (U s);
|
||||
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);
|
||||
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);
|
||||
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);
|
||||
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);
|
||||
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);
|
||||
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 T, precision P>
|
||||
GLM_FUNC_DECL tvec2<T, P> operator+(tvec2<T, P> const & v, T const & s);
|
||||
|
||||
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);
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tvec2<T, P> operator+(tvec1<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 & 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);
|
||||
|
||||
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);
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tvec2<T, P> operator- (tvec2<T, P> const & v1, tvec2<T, P> const & v2);
|
||||
GLM_FUNC_DECL tvec2<T, P> operator-(tvec1<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 & 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);
|
||||
|
||||
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);
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tvec2<T, P> operator*(tvec1<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 & 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);
|
||||
|
||||
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);
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tvec2<T, P> operator/(tvec1<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 & v1, tvec2<T, P> const & v2);
|
||||
|
||||
@ -251,65 +304,97 @@ namespace detail
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tvec2<T, P> operator%(tvec2<T, P> const & v, T const & s);
|
||||
|
||||
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);
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tvec2<T, P> operator%(tvec1<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 & 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);
|
||||
|
||||
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);
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tvec2<T, P> operator&(tvec1<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 & 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);
|
||||
|
||||
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);
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tvec2<T, P> operator|(tvec1<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 & 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);
|
||||
|
||||
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);
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tvec2<T, P> operator^(tvec1<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 & 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);
|
||||
|
||||
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);
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tvec2<T, P> operator<<(tvec1<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 & 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);
|
||||
|
||||
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);
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tvec2<T, P> operator>>(tvec1<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 & v1, tvec2<T, P> const & v2);
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tvec2<T, P> operator~(tvec2<T, P> const & v);
|
||||
|
||||
}//namespace detail
|
||||
}//namespace glm
|
||||
|
||||
#ifndef GLM_EXTERNAL_TEMPLATE
|
||||
#include "type_vec2.inl"
|
||||
#endif//GLM_EXTERNAL_TEMPLATE
|
||||
|
||||
#endif//glm_core_type_gentype2
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -12,6 +12,10 @@
|
||||
/// 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
|
||||
@ -21,13 +25,12 @@
|
||||
/// THE SOFTWARE.
|
||||
///
|
||||
/// @ref core
|
||||
/// @file glm/core/type_vec3.hpp
|
||||
/// @file glm/detail/type_vec3.hpp
|
||||
/// @date 2008-08-22 / 2011-06-15
|
||||
/// @author Christophe Riccio
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef glm_core_type_gentype3
|
||||
#define glm_core_type_gentype3
|
||||
#pragma once
|
||||
|
||||
//#include "../fwd.hpp"
|
||||
#include "type_vec.hpp"
|
||||
@ -40,46 +43,39 @@
|
||||
#endif //GLM_SWIZZLE
|
||||
#include <cstddef>
|
||||
|
||||
namespace glm{
|
||||
namespace detail
|
||||
namespace glm
|
||||
{
|
||||
template <typename T, precision P>
|
||||
template <typename T, precision P = defaultp>
|
||||
struct tvec3
|
||||
{
|
||||
//////////////////////////////////////
|
||||
// Implementation detail
|
||||
|
||||
enum ctor{_null};
|
||||
|
||||
typedef tvec3<T, P> type;
|
||||
typedef tvec3<bool, P> bool_type;
|
||||
typedef T value_type;
|
||||
typedef int size_type;
|
||||
|
||||
//////////////////////////////////////
|
||||
// Helper
|
||||
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const;
|
||||
|
||||
//////////////////////////////////////
|
||||
// Data
|
||||
|
||||
# if(GLM_HAS_ANONYMOUS_UNION && defined(GLM_SWIZZLE))
|
||||
# if GLM_HAS_ANONYMOUS_UNION
|
||||
union
|
||||
{
|
||||
struct{ T x, y, z; };
|
||||
struct{ T r, g, b; };
|
||||
struct{ T s, t, p; };
|
||||
|
||||
_GLM_SWIZZLE3_2_MEMBERS(T, P, tvec2, x, y, z)
|
||||
_GLM_SWIZZLE3_2_MEMBERS(T, P, tvec2, r, g, b)
|
||||
_GLM_SWIZZLE3_2_MEMBERS(T, P, tvec2, s, t, p)
|
||||
_GLM_SWIZZLE3_3_MEMBERS(T, P, tvec3, x, y, z)
|
||||
_GLM_SWIZZLE3_3_MEMBERS(T, P, tvec3, r, g, b)
|
||||
_GLM_SWIZZLE3_3_MEMBERS(T, P, tvec3, s, t, p)
|
||||
_GLM_SWIZZLE3_4_MEMBERS(T, P, tvec4, x, y, z)
|
||||
_GLM_SWIZZLE3_4_MEMBERS(T, P, tvec4, r, g, b)
|
||||
_GLM_SWIZZLE3_4_MEMBERS(T, P, tvec4, s, t, p)
|
||||
# ifdef GLM_SWIZZLE
|
||||
_GLM_SWIZZLE3_2_MEMBERS(T, P, tvec2, x, y, z)
|
||||
_GLM_SWIZZLE3_2_MEMBERS(T, P, tvec2, r, g, b)
|
||||
_GLM_SWIZZLE3_2_MEMBERS(T, P, tvec2, s, t, p)
|
||||
_GLM_SWIZZLE3_3_MEMBERS(T, P, tvec3, x, y, z)
|
||||
_GLM_SWIZZLE3_3_MEMBERS(T, P, tvec3, r, g, b)
|
||||
_GLM_SWIZZLE3_3_MEMBERS(T, P, tvec3, s, t, p)
|
||||
_GLM_SWIZZLE3_4_MEMBERS(T, P, tvec4, x, y, z)
|
||||
_GLM_SWIZZLE3_4_MEMBERS(T, P, tvec4, r, g, b)
|
||||
_GLM_SWIZZLE3_4_MEMBERS(T, P, tvec4, s, t, p)
|
||||
# endif//GLM_SWIZZLE
|
||||
};
|
||||
# else
|
||||
union { T x, r, s; };
|
||||
@ -87,107 +83,132 @@ namespace detail
|
||||
union { T z, b, p; };
|
||||
|
||||
# ifdef GLM_SWIZZLE
|
||||
GLM_SWIZZLE_GEN_VEC_FROM_VEC3(T, P, detail::tvec3, detail::tvec2, detail::tvec3, detail::tvec4)
|
||||
# endif
|
||||
GLM_SWIZZLE_GEN_VEC_FROM_VEC3(T, P, tvec3, tvec2, tvec3, tvec4)
|
||||
# endif//GLM_SWIZZLE
|
||||
# endif//GLM_LANG
|
||||
|
||||
//////////////////////////////////////
|
||||
// Accesses
|
||||
// Component accesses
|
||||
|
||||
GLM_FUNC_DECL T & operator[](length_t i);
|
||||
GLM_FUNC_DECL T const & operator[](length_t i) const;
|
||||
# ifdef GLM_FORCE_SIZE_FUNC
|
||||
/// Return the count of components of the vector
|
||||
typedef size_t size_type;
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR size_type size() const;
|
||||
|
||||
GLM_FUNC_DECL T & operator[](size_type i);
|
||||
GLM_FUNC_DECL T const & operator[](size_type i) const;
|
||||
# else
|
||||
/// Return the count of components of the vector
|
||||
typedef length_t length_type;
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR length_type length() const;
|
||||
|
||||
GLM_FUNC_DECL T & operator[](length_type i);
|
||||
GLM_FUNC_DECL T const & operator[](length_type i) const;
|
||||
# endif//GLM_FORCE_SIZE_FUNC
|
||||
|
||||
//////////////////////////////////////
|
||||
// Implicit basic constructors
|
||||
|
||||
GLM_FUNC_DECL tvec3();
|
||||
GLM_FUNC_DECL tvec3(tvec3<T, P> const & v);
|
||||
template <precision Q>
|
||||
GLM_FUNC_DECL tvec3(tvec3<T, Q> const & v);
|
||||
|
||||
//////////////////////////////////////
|
||||
// Explicit basic constructors
|
||||
|
||||
GLM_FUNC_DECL explicit tvec3(
|
||||
ctor);
|
||||
GLM_FUNC_DECL explicit tvec3(
|
||||
T const & s);
|
||||
GLM_FUNC_DECL tvec3(
|
||||
T const & s1,
|
||||
T const & s2,
|
||||
T const & s3);
|
||||
GLM_FUNC_DECL explicit tvec3(ctor);
|
||||
GLM_FUNC_DECL explicit tvec3(T const & s);
|
||||
GLM_FUNC_DECL tvec3(T const & a, T const & b, T const & c);
|
||||
|
||||
//////////////////////////////////////
|
||||
// Conversion scalar constructors
|
||||
|
||||
//! Explicit converions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
|
||||
template <typename U, typename V, typename W>
|
||||
GLM_FUNC_DECL tvec3(
|
||||
U const & x,
|
||||
V const & y,
|
||||
W const & z);
|
||||
/// Explicit converions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
|
||||
template <typename A, typename B, typename C>
|
||||
GLM_FUNC_DECL tvec3(A const & a, B const & b, C const & c);
|
||||
template <typename A, typename B, typename C>
|
||||
GLM_FUNC_DECL tvec3(tvec1<A, P> const & a, tvec1<B, P> const & b, tvec1<C, P> const & c);
|
||||
|
||||
//////////////////////////////////////
|
||||
// Conversion vector constructors
|
||||
|
||||
//! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
|
||||
template <typename A, typename B, precision Q>
|
||||
GLM_FUNC_DECL explicit tvec3(tvec2<A, Q> const & v, B const & s);
|
||||
GLM_FUNC_DECL explicit tvec3(tvec2<A, Q> const & a, B const & b);
|
||||
//! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
|
||||
template <typename A, typename B, precision Q>
|
||||
GLM_FUNC_DECL explicit tvec3(A const & s, tvec2<B, Q> const & v);
|
||||
GLM_FUNC_DECL explicit tvec3(tvec2<A, Q> const & a, tvec1<B, Q> const & b);
|
||||
//! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
|
||||
template <typename U, precision Q>
|
||||
GLM_FUNC_DECL explicit tvec3(tvec3<U, Q> const & v);
|
||||
template <typename A, typename B, precision Q>
|
||||
GLM_FUNC_DECL explicit tvec3(A const & a, tvec2<B, Q> const & b);
|
||||
//! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
|
||||
template <typename A, typename B, precision Q>
|
||||
GLM_FUNC_DECL explicit tvec3(tvec1<A, Q> const & a, tvec2<B, Q> const & b);
|
||||
//! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
|
||||
template <typename U, precision Q>
|
||||
GLM_FUNC_DECL explicit tvec3(tvec4<U, Q> const & v);
|
||||
|
||||
# ifdef GLM_FORCE_EXPLICIT_CTOR
|
||||
//! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
|
||||
template <typename U, precision Q>
|
||||
GLM_FUNC_DECL explicit tvec3(tvec3<U, Q> const & v);
|
||||
# else
|
||||
//! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
|
||||
template <typename U, precision Q>
|
||||
GLM_FUNC_DECL tvec3(tvec3<U, Q> const & v);
|
||||
# endif
|
||||
|
||||
//////////////////////////////////////
|
||||
// Swizzle constructors
|
||||
|
||||
# if(GLM_HAS_ANONYMOUS_UNION && defined(GLM_SWIZZLE))
|
||||
template <int E0, int E1, int E2>
|
||||
GLM_FUNC_DECL tvec3(_swizzle<3, T, P, tvec3<T, P>, E0, E1, E2, -1> const & that)
|
||||
{
|
||||
*this = that();
|
||||
}
|
||||
# if GLM_HAS_ANONYMOUS_UNION && defined(GLM_SWIZZLE)
|
||||
template <int E0, int E1, int E2>
|
||||
GLM_FUNC_DECL tvec3(detail::_swizzle<3, T, P, tvec3<T, P>, E0, E1, E2, -1> const & that)
|
||||
{
|
||||
*this = that();
|
||||
}
|
||||
|
||||
template <int E0, int E1>
|
||||
GLM_FUNC_DECL tvec3(_swizzle<2, T, P, tvec2<T, P>, E0, E1, -1, -2> const & v, T const & s)
|
||||
{
|
||||
*this = tvec3<T, P>(v(), s);
|
||||
}
|
||||
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)
|
||||
{
|
||||
*this = tvec3<T, P>(v(), s);
|
||||
}
|
||||
|
||||
template <int E0, int E1>
|
||||
GLM_FUNC_DECL tvec3(T const & s, _swizzle<2, T, P, tvec2<T, P>, E0, E1, -1, -2> const & v)
|
||||
{
|
||||
*this = tvec3<T, P>(s, v());
|
||||
}
|
||||
# endif//(GLM_HAS_ANONYMOUS_UNION && defined(GLM_SWIZZLE))
|
||||
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)
|
||||
{
|
||||
*this = tvec3<T, P>(s, v());
|
||||
}
|
||||
# endif// GLM_HAS_ANONYMOUS_UNION && defined(GLM_SWIZZLE)
|
||||
|
||||
//////////////////////////////////////
|
||||
// Unary arithmetic operators
|
||||
|
||||
GLM_FUNC_DECL tvec3<T, P> & operator= (tvec3<T, P> const & v);
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tvec3<T, P> & operator= (tvec3<U, P> const & v);
|
||||
|
||||
template <typename U>
|
||||
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);
|
||||
template <typename U>
|
||||
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>
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tvec3<T, P> & operator-=(U s);
|
||||
template <typename U>
|
||||
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>
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tvec3<T, P> & operator*=(U s);
|
||||
template <typename U>
|
||||
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>
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tvec3<T, P> & operator/=(U s);
|
||||
template <typename U>
|
||||
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);
|
||||
|
||||
//////////////////////////////////////
|
||||
@ -202,64 +223,100 @@ namespace detail
|
||||
// Unary bit operators
|
||||
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tvec3<T, P> & operator%= (U s);
|
||||
GLM_FUNC_DECL tvec3<T, P> & operator%=(U s);
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tvec3<T, P> & operator%= (tvec3<U, P> const & v);
|
||||
GLM_FUNC_DECL tvec3<T, P> & operator%=(tvec1<U, P> const & v);
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tvec3<T, P> & operator&= (U s);
|
||||
GLM_FUNC_DECL tvec3<T, P> & operator%=(tvec3<U, P> const & v);
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tvec3<T, P> & operator&= (tvec3<U, P> const & v);
|
||||
GLM_FUNC_DECL tvec3<T, P> & operator&=(U s);
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tvec3<T, P> & operator|= (U s);
|
||||
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);
|
||||
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 s);
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tvec3<T, P> & operator^= (tvec3<U, P> const & v);
|
||||
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);
|
||||
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);
|
||||
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);
|
||||
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 T, precision P>
|
||||
GLM_FUNC_DECL tvec3<T, P> operator+(tvec3<T, P> const & v, T const & s);
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tvec3<T, P> operator+(tvec3<T, P> const & v, tvec1<T, P> const & s);
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tvec3<T, P> operator+(T const & s, 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);
|
||||
|
||||
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 & s);
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tvec3<T, P> operator-(tvec3<T, P> const & v, tvec1<T, P> const & s);
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tvec3<T, P> operator-(T const & s, 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);
|
||||
GLM_FUNC_DECL tvec3<T, P> operator-(tvec1<T, P> const & s, 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);
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tvec3<T, P> operator*(tvec3<T, P> const & v, tvec1<T, P> const & s);
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tvec3<T, P> operator*(T const & s, 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);
|
||||
|
||||
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);
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tvec3<T, P> operator/(tvec3<T, P> const & v, tvec1<T, P> const & s);
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tvec3<T, P> operator/(T const & s, 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);
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tvec3<T, P> operator/(tvec3<T, P> const & v1, tvec3<T, P> const & v2);
|
||||
|
||||
@ -269,65 +326,97 @@ namespace detail
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tvec3<T, P> operator%(tvec3<T, P> const & v, T const & s);
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tvec3<T, P> operator%(tvec3<T, P> const & v, tvec1<T, P> const & s);
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tvec3<T, P> operator%(T const & s, 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);
|
||||
|
||||
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);
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tvec3<T, P> operator&(tvec3<T, P> const & v, tvec1<T, P> const & s);
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tvec3<T, P> operator&(T const & s, 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);
|
||||
|
||||
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);
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tvec3<T, P> operator|(tvec3<T, P> const & v, tvec1<T, P> const & s);
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tvec3<T, P> operator|(T const & s, 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);
|
||||
|
||||
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);
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tvec3<T, P> operator^(tvec3<T, P> const & v, tvec1<T, P> const & s);
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tvec3<T, P> operator^(T const & s, 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);
|
||||
|
||||
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);
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tvec3<T, P> operator<<(tvec3<T, P> const & v, tvec1<T, P> const & s);
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tvec3<T, P> operator<<(T const & s, 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);
|
||||
|
||||
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);
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tvec3<T, P> operator>>(tvec3<T, P> const & v, tvec1<T, P> const & s);
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tvec3<T, P> operator>>(T const & s, 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);
|
||||
|
||||
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);
|
||||
|
||||
}//namespace detail
|
||||
}//namespace glm
|
||||
|
||||
#ifndef GLM_EXTERNAL_TEMPLATE
|
||||
#include "type_vec3.inl"
|
||||
#endif//GLM_EXTERNAL_TEMPLATE
|
||||
|
||||
#endif//glm_core_type_gentype3
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -12,6 +12,10 @@
|
||||
/// 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
|
||||
@ -21,13 +25,12 @@
|
||||
/// THE SOFTWARE.
|
||||
///
|
||||
/// @ref core
|
||||
/// @file glm/core/type_vec4.hpp
|
||||
/// @file glm/detail/type_vec4.hpp
|
||||
/// @date 2008-08-22 / 2011-06-15
|
||||
/// @author Christophe Riccio
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef glm_core_type_gentype4
|
||||
#define glm_core_type_gentype4
|
||||
#pragma once
|
||||
|
||||
//#include "../fwd.hpp"
|
||||
#include "setup.hpp"
|
||||
@ -44,43 +47,90 @@
|
||||
namespace glm{
|
||||
namespace detail
|
||||
{
|
||||
template <typename T, precision P>
|
||||
template <typename T>
|
||||
struct simd
|
||||
{
|
||||
typedef T type[4];
|
||||
};
|
||||
|
||||
# define GLM_NOT_BUGGY_VC32BITS !(GLM_MODEL == GLM_MODEL_32 && GLM_COMPILER & GLM_COMPILER_VC && GLM_COMPILER < GLM_COMPILER_VC2013)
|
||||
|
||||
# if GLM_ARCH & GLM_ARCH_SSE2 && GLM_NOT_BUGGY_VC32BITS
|
||||
template <>
|
||||
struct simd<float>
|
||||
{
|
||||
typedef __m128 type;
|
||||
};
|
||||
|
||||
template <>
|
||||
struct simd<int>
|
||||
{
|
||||
typedef __m128i type;
|
||||
};
|
||||
|
||||
template <>
|
||||
struct simd<unsigned int>
|
||||
{
|
||||
typedef __m128i type;
|
||||
};
|
||||
# endif
|
||||
|
||||
# if GLM_ARCH & GLM_ARCH_AVX && GLM_NOT_BUGGY_VC32BITS
|
||||
template <>
|
||||
struct simd<double>
|
||||
{
|
||||
typedef __m256d type;
|
||||
};
|
||||
# endif
|
||||
|
||||
# if GLM_ARCH & GLM_ARCH_AVX2 && GLM_NOT_BUGGY_VC32BITS
|
||||
template <>
|
||||
struct simd<int64>
|
||||
{
|
||||
typedef __m256i type;
|
||||
};
|
||||
|
||||
template <>
|
||||
struct simd<uint64>
|
||||
{
|
||||
typedef __m256i type;
|
||||
};
|
||||
# endif
|
||||
|
||||
}//namespace detail
|
||||
|
||||
template <typename T, precision P = defaultp>
|
||||
struct tvec4
|
||||
{
|
||||
//////////////////////////////////////
|
||||
// Implementation detail
|
||||
|
||||
enum ctor{_null};
|
||||
|
||||
typedef tvec4<T, P> type;
|
||||
typedef tvec4<bool, P> bool_type;
|
||||
typedef T value_type;
|
||||
typedef int size_type;
|
||||
|
||||
//////////////////////////////////////
|
||||
// Helper
|
||||
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const;
|
||||
|
||||
//////////////////////////////////////
|
||||
// Data
|
||||
|
||||
# if(GLM_HAS_ANONYMOUS_UNION && defined(GLM_SWIZZLE))
|
||||
# if GLM_HAS_ANONYMOUS_UNION
|
||||
union
|
||||
{
|
||||
typename detail::simd<T>::type data;
|
||||
struct { T r, g, b, a; };
|
||||
struct { T s, t, p, q; };
|
||||
struct { T x, y, z, w;};
|
||||
|
||||
_GLM_SWIZZLE4_2_MEMBERS(T, P, tvec2, x, y, z, w)
|
||||
_GLM_SWIZZLE4_2_MEMBERS(T, P, tvec2, r, g, b, a)
|
||||
_GLM_SWIZZLE4_2_MEMBERS(T, P, tvec2, s, t, p, q)
|
||||
_GLM_SWIZZLE4_3_MEMBERS(T, P, tvec3, x, y, z, w)
|
||||
_GLM_SWIZZLE4_3_MEMBERS(T, P, tvec3, r, g, b, a)
|
||||
_GLM_SWIZZLE4_3_MEMBERS(T, P, tvec3, s, t, p, q)
|
||||
_GLM_SWIZZLE4_4_MEMBERS(T, P, tvec4, x, y, z, w)
|
||||
_GLM_SWIZZLE4_4_MEMBERS(T, P, tvec4, r, g, b, a)
|
||||
_GLM_SWIZZLE4_4_MEMBERS(T, P, tvec4, s, t, p, q)
|
||||
# ifdef GLM_SWIZZLE
|
||||
_GLM_SWIZZLE4_2_MEMBERS(T, P, tvec2, x, y, z, w)
|
||||
_GLM_SWIZZLE4_2_MEMBERS(T, P, tvec2, r, g, b, a)
|
||||
_GLM_SWIZZLE4_2_MEMBERS(T, P, tvec2, s, t, p, q)
|
||||
_GLM_SWIZZLE4_3_MEMBERS(T, P, tvec3, x, y, z, w)
|
||||
_GLM_SWIZZLE4_3_MEMBERS(T, P, tvec3, r, g, b, a)
|
||||
_GLM_SWIZZLE4_3_MEMBERS(T, P, tvec3, s, t, p, q)
|
||||
_GLM_SWIZZLE4_4_MEMBERS(T, P, tvec4, x, y, z, w)
|
||||
_GLM_SWIZZLE4_4_MEMBERS(T, P, tvec4, r, g, b, a)
|
||||
_GLM_SWIZZLE4_4_MEMBERS(T, P, tvec4, s, t, p, q)
|
||||
# endif//GLM_SWIZZLE
|
||||
};
|
||||
# else
|
||||
union { T x, r, s; };
|
||||
@ -89,141 +139,174 @@ namespace detail
|
||||
union { T w, a, q; };
|
||||
|
||||
# ifdef GLM_SWIZZLE
|
||||
GLM_SWIZZLE_GEN_VEC_FROM_VEC4(T, P, detail::tvec4, detail::tvec2, detail::tvec3, detail::tvec4)
|
||||
# endif
|
||||
GLM_SWIZZLE_GEN_VEC_FROM_VEC4(T, P, tvec4, tvec2, tvec3, tvec4)
|
||||
# endif//GLM_SWIZZLE
|
||||
# endif//GLM_LANG
|
||||
|
||||
//////////////////////////////////////
|
||||
// Accesses
|
||||
// Component accesses
|
||||
|
||||
GLM_FUNC_DECL T & operator[](length_t i);
|
||||
GLM_FUNC_DECL T const & operator[](length_t i) const;
|
||||
# ifdef GLM_FORCE_SIZE_FUNC
|
||||
/// Return the count of components of the vector
|
||||
typedef size_t size_type;
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR size_type size() const;
|
||||
|
||||
GLM_FUNC_DECL T & operator[](size_type i);
|
||||
GLM_FUNC_DECL T const & operator[](size_type i) const;
|
||||
# else
|
||||
/// Return the count of components of the vector
|
||||
typedef length_t length_type;
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR length_type length() const;
|
||||
|
||||
GLM_FUNC_DECL T & operator[](length_type i);
|
||||
GLM_FUNC_DECL T const & operator[](length_type i) const;
|
||||
# endif//GLM_FORCE_SIZE_FUNC
|
||||
|
||||
//////////////////////////////////////
|
||||
// Implicit basic constructors
|
||||
|
||||
GLM_FUNC_DECL tvec4();
|
||||
GLM_FUNC_DECL tvec4(type const & v);
|
||||
template <precision Q>
|
||||
GLM_FUNC_DECL tvec4(tvec4<T, Q> const & v);
|
||||
|
||||
//////////////////////////////////////
|
||||
// Explicit basic constructors
|
||||
|
||||
GLM_FUNC_DECL explicit tvec4(
|
||||
ctor);
|
||||
GLM_FUNC_DECL explicit tvec4(
|
||||
T const & s);
|
||||
GLM_FUNC_DECL tvec4(
|
||||
T const & s0,
|
||||
T const & s1,
|
||||
T const & s2,
|
||||
T const & s3);
|
||||
GLM_FUNC_DECL explicit tvec4(ctor);
|
||||
GLM_FUNC_DECL explicit tvec4(T s);
|
||||
GLM_FUNC_DECL tvec4(T a, T b, T c, T d);
|
||||
GLM_FUNC_DECL ~tvec4(){}
|
||||
|
||||
//////////////////////////////////////
|
||||
// Conversion scalar constructors
|
||||
|
||||
/// Explicit converions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
|
||||
template <typename A, typename B, typename C, typename D>
|
||||
GLM_FUNC_DECL tvec4(
|
||||
A const & x,
|
||||
B const & y,
|
||||
C const & z,
|
||||
D const & w);
|
||||
GLM_FUNC_DECL tvec4(A a, B b, C c, D d);
|
||||
template <typename A, typename B, typename C, typename D>
|
||||
GLM_FUNC_DECL tvec4(tvec1<A, P> const & a, tvec1<B, P> const & b, tvec1<C, P> const & c, tvec1<D, P> const & d);
|
||||
|
||||
//////////////////////////////////////
|
||||
// Conversion vector constructors
|
||||
|
||||
//! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
|
||||
template <typename A, typename B, typename C, precision Q>
|
||||
GLM_FUNC_DECL explicit tvec4(tvec2<A, Q> const & v, B const & s1, C const & s2);
|
||||
GLM_FUNC_DECL explicit tvec4(tvec2<A, Q> const & a, B b, C c);
|
||||
//! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
|
||||
template <typename A, typename B, typename C, precision Q>
|
||||
GLM_FUNC_DECL explicit tvec4(A const & s1, tvec2<B, Q> const & v, C const & s2);
|
||||
GLM_FUNC_DECL explicit tvec4(tvec2<A, Q> const & a, tvec1<B, Q> const & b, tvec1<C, Q> const & c);
|
||||
//! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
|
||||
template <typename A, typename B, typename C, precision Q>
|
||||
GLM_FUNC_DECL explicit tvec4(A const & s1, B const & s2, tvec2<C, Q> const & v);
|
||||
GLM_FUNC_DECL explicit tvec4(A a, tvec2<B, Q> const & b, C c);
|
||||
//! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
|
||||
template <typename A, typename B, typename C, precision Q>
|
||||
GLM_FUNC_DECL explicit tvec4(tvec1<A, Q> const & a, tvec2<B, Q> const & b, tvec1<C, Q> const & c);
|
||||
//! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
|
||||
template <typename A, typename B, typename C, precision Q>
|
||||
GLM_FUNC_DECL explicit tvec4(A a, B b, tvec2<C, Q> const & c);
|
||||
//! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
|
||||
template <typename A, typename B, typename C, precision Q>
|
||||
GLM_FUNC_DECL explicit tvec4(tvec1<A, Q> const & a, tvec1<B, Q> const & b, tvec2<C, Q> const & c);
|
||||
//! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
|
||||
template <typename A, typename B, precision Q>
|
||||
GLM_FUNC_DECL explicit tvec4(tvec3<A, Q> const & v, B const & s);
|
||||
GLM_FUNC_DECL explicit tvec4(tvec3<A, Q> const & a, B b);
|
||||
//! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
|
||||
template <typename A, typename B, precision Q>
|
||||
GLM_FUNC_DECL explicit tvec4(A const & s, tvec3<B, Q> const & v);
|
||||
GLM_FUNC_DECL explicit tvec4(tvec3<A, Q> const & a, tvec1<B, Q> const & b);
|
||||
//! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
|
||||
template <typename A, typename B, precision Q>
|
||||
GLM_FUNC_DECL explicit tvec4(tvec2<A, Q> const & v1, tvec2<B, Q> const & v2);
|
||||
GLM_FUNC_DECL explicit tvec4(A a, tvec3<B, Q> const & b);
|
||||
//! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
|
||||
template <typename U, precision Q>
|
||||
GLM_FUNC_DECL explicit tvec4(tvec4<U, Q> const & v);
|
||||
template <typename A, typename B, precision Q>
|
||||
GLM_FUNC_DECL explicit tvec4(tvec1<A, Q> const & a, tvec3<B, Q> const & b);
|
||||
//! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
|
||||
template <typename A, typename B, precision Q>
|
||||
GLM_FUNC_DECL explicit tvec4(tvec2<A, Q> const & a, tvec2<B, Q> const & b);
|
||||
|
||||
# ifdef GLM_FORCE_EXPLICIT_CTOR
|
||||
//! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
|
||||
template <typename U, precision Q>
|
||||
GLM_FUNC_DECL explicit tvec4(tvec4<U, Q> const & v);
|
||||
# else
|
||||
//! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
|
||||
template <typename U, precision Q>
|
||||
GLM_FUNC_DECL tvec4(tvec4<U, Q> const & v);
|
||||
# endif
|
||||
|
||||
//////////////////////////////////////
|
||||
// Swizzle constructors
|
||||
|
||||
# if(GLM_HAS_ANONYMOUS_UNION && defined(GLM_SWIZZLE))
|
||||
template <int E0, int E1, int E2, int E3>
|
||||
GLM_FUNC_DECL tvec4(_swizzle<4, T, P, tvec4<T, P>, E0, E1, E2, E3> const & that)
|
||||
{
|
||||
*this = that();
|
||||
}
|
||||
# if GLM_HAS_ANONYMOUS_UNION && defined(GLM_SWIZZLE)
|
||||
template <int E0, int E1, int E2, int E3>
|
||||
GLM_FUNC_DECL tvec4(detail::_swizzle<4, T, P, tvec4<T, P>, E0, E1, E2, E3> const & that)
|
||||
{
|
||||
*this = that();
|
||||
}
|
||||
|
||||
template <int E0, int E1, int F0, int F1>
|
||||
GLM_FUNC_DECL tvec4(_swizzle<2, T, P, tvec2<T, P>, E0, E1, -1, -2> const & v, _swizzle<2, T, P, tvec2<T, P>, F0, F1, -1, -2> const & u)
|
||||
{
|
||||
*this = tvec4<T, P>(v(), u());
|
||||
}
|
||||
template <int E0, int E1, int F0, int F1>
|
||||
GLM_FUNC_DECL tvec4(detail::_swizzle<2, T, P, tvec2<T, P>, E0, E1, -1, -2> const & v, detail::_swizzle<2, T, P, tvec2<T, P>, F0, F1, -1, -2> const & u)
|
||||
{
|
||||
*this = tvec4<T, P>(v(), u());
|
||||
}
|
||||
|
||||
template <int E0, int E1>
|
||||
GLM_FUNC_DECL tvec4(T const & x, T const & y, _swizzle<2, T, P, tvec2<T, P>, E0, E1, -1, -2> const & v)
|
||||
{
|
||||
*this = tvec4<T, P>(x, y, v());
|
||||
}
|
||||
template <int E0, int E1>
|
||||
GLM_FUNC_DECL tvec4(T const & x, T const & y, detail::_swizzle<2, T, P, tvec2<T, P>, E0, E1, -1, -2> const & v)
|
||||
{
|
||||
*this = tvec4<T, P>(x, y, v());
|
||||
}
|
||||
|
||||
template <int E0, int E1>
|
||||
GLM_FUNC_DECL tvec4(T const & x, _swizzle<2, T, P, tvec2<T, P>, E0, E1, -1, -2> const & v, T const & w)
|
||||
{
|
||||
*this = tvec4<T, P>(x, v(), w);
|
||||
}
|
||||
template <int E0, int E1>
|
||||
GLM_FUNC_DECL tvec4(T const & x, detail::_swizzle<2, T, P, tvec2<T, P>, E0, E1, -1, -2> const & v, T const & w)
|
||||
{
|
||||
*this = tvec4<T, P>(x, v(), w);
|
||||
}
|
||||
|
||||
template <int E0, int E1>
|
||||
GLM_FUNC_DECL tvec4(_swizzle<2, T, P, tvec2<T, P>, E0, E1, -1, -2> const & v, T const & z, T const & w)
|
||||
{
|
||||
*this = tvec4<T, P>(v(), z, w);
|
||||
}
|
||||
template <int E0, int E1>
|
||||
GLM_FUNC_DECL tvec4(detail::_swizzle<2, T, P, tvec2<T, P>, E0, E1, -1, -2> const & v, T const & z, T const & w)
|
||||
{
|
||||
*this = tvec4<T, P>(v(), z, w);
|
||||
}
|
||||
|
||||
template <int E0, int E1, int E2>
|
||||
GLM_FUNC_DECL tvec4(_swizzle<3, T, P, tvec3<T, P>, E0, E1, E2, -1> const & v, T const & w)
|
||||
{
|
||||
*this = tvec4<T, P>(v(), w);
|
||||
}
|
||||
template <int E0, int E1, int E2>
|
||||
GLM_FUNC_DECL tvec4(detail::_swizzle<3, T, P, tvec3<T, P>, E0, E1, E2, -1> const & v, T const & w)
|
||||
{
|
||||
*this = tvec4<T, P>(v(), w);
|
||||
}
|
||||
|
||||
template <int E0, int E1, int E2>
|
||||
GLM_FUNC_DECL tvec4(T const & x, _swizzle<3, T, P, tvec3<T, P>, E0, E1, E2, -1> const & v)
|
||||
{
|
||||
*this = tvec4<T, P>(x, v());
|
||||
}
|
||||
# endif//(GLM_HAS_ANONYMOUS_UNION && defined(GLM_SWIZZLE))
|
||||
template <int E0, int E1, int E2>
|
||||
GLM_FUNC_DECL tvec4(T const & x, detail::_swizzle<3, T, P, tvec3<T, P>, E0, E1, E2, -1> const & v)
|
||||
{
|
||||
*this = tvec4<T, P>(x, v());
|
||||
}
|
||||
# endif// GLM_HAS_ANONYMOUS_UNION && defined(GLM_SWIZZLE)
|
||||
|
||||
//////////////////////////////////////
|
||||
// Unary arithmetic operators
|
||||
|
||||
GLM_FUNC_DECL tvec4<T, P> & operator= (tvec4<T, P> const & v);
|
||||
template <typename U, precision Q>
|
||||
GLM_FUNC_DECL tvec4<T, P> & operator= (tvec4<U, Q> const & v);
|
||||
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tvec4<T, P> & operator+=(U s);
|
||||
GLM_FUNC_DECL tvec4<T, P> & operator=(tvec4<U, P> const & v);
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tvec4<T, P> & operator+=(U scalar);
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tvec4<T, P> & operator+=(tvec1<U, P> const & v);
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tvec4<T, P> & operator+=(tvec4<U, P> const & v);
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tvec4<T, P> & operator-=(U s);
|
||||
GLM_FUNC_DECL tvec4<T, P> & operator-=(U scalar);
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tvec4<T, P> & operator-=(tvec1<U, P> const & v);
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tvec4<T, P> & operator-=(tvec4<U, P> const & v);
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tvec4<T, P> & operator*=(U s);
|
||||
GLM_FUNC_DECL tvec4<T, P> & operator*=(U scalar);
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tvec4<T, P> & operator*=(tvec1<U, P> const & v);
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tvec4<T, P> & operator*=(tvec4<U, P> const & v);
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tvec4<T, P> & operator/=(U s);
|
||||
GLM_FUNC_DECL tvec4<T, P> & operator/=(U scalar);
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tvec4<T, P> & operator/=(tvec1<U, P> const & v);
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tvec4<T, P> & operator/=(tvec4<U, P> const & v);
|
||||
|
||||
@ -239,63 +322,99 @@ namespace detail
|
||||
// Unary bit operators
|
||||
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tvec4<T, P> & operator%= (U s);
|
||||
GLM_FUNC_DECL tvec4<T, P> & operator%=(U scalar);
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tvec4<T, P> & operator%= (tvec4<U, P> const & v);
|
||||
GLM_FUNC_DECL tvec4<T, P> & operator%=(tvec1<U, P> const & v);
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tvec4<T, P> & operator&= (U s);
|
||||
GLM_FUNC_DECL tvec4<T, P> & operator%=(tvec4<U, P> const & v);
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tvec4<T, P> & operator&= (tvec4<U, P> const & v);
|
||||
GLM_FUNC_DECL tvec4<T, P> & operator&=(U scalar);
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tvec4<T, P> & operator|= (U s);
|
||||
GLM_FUNC_DECL tvec4<T, P> & operator&=(tvec1<U, P> const & v);
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tvec4<T, P> & operator|= (tvec4<U, P> const & v);
|
||||
GLM_FUNC_DECL tvec4<T, P> & operator&=(tvec4<U, P> const & v);
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tvec4<T, P> & operator^= (U s);
|
||||
GLM_FUNC_DECL tvec4<T, P> & operator|=(U scalar);
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tvec4<T, P> & operator^= (tvec4<U, P> const & v);
|
||||
GLM_FUNC_DECL tvec4<T, P> & operator|=(tvec1<U, P> const & v);
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tvec4<T, P> & operator<<=(U s);
|
||||
GLM_FUNC_DECL tvec4<T, P> & operator|=(tvec4<U, P> const & v);
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tvec4<T, P> & operator^=(U scalar);
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tvec4<T, P> & operator^=(tvec1<U, P> const & v);
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tvec4<T, P> & operator^=(tvec4<U, P> const & v);
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tvec4<T, P> & operator<<=(U scalar);
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tvec4<T, P> & operator<<=(tvec1<U, P> const & v);
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tvec4<T, P> & operator<<=(tvec4<U, P> const & v);
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tvec4<T, P> & operator>>=(U s);
|
||||
GLM_FUNC_DECL tvec4<T, P> & operator>>=(U scalar);
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tvec4<T, P> & operator>>=(tvec1<U, P> const & v);
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tvec4<T, P> & operator>>=(tvec4<U, P> const & v);
|
||||
};
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tvec4<T, P> operator+(tvec4<T, P> const & v, T const & s);
|
||||
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+(T const & s, tvec4<T, P> const & v);
|
||||
GLM_FUNC_DECL tvec4<T, P> operator+(tvec4<T, P> const & v, tvec1<T, P> const & s);
|
||||
|
||||
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);
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tvec4<T, P> operator+(tvec4<T, P> const & v1, tvec4<T, P> const & v2);
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tvec4<T, P> operator-(tvec4<T, P> const & v, T const & s);
|
||||
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-(T const & s, tvec4<T, P> const & v);
|
||||
GLM_FUNC_DECL tvec4<T, P> operator-(tvec4<T, P> const & v, tvec1<T, P> const & s);
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tvec4<T, P> operator- (tvec4<T, P> const & v1, tvec4<T, P> const & v2);
|
||||
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*(tvec4<T, P> const & v, T const & s);
|
||||
GLM_FUNC_DECL tvec4<T, P> operator-(tvec1<T, P> const & s, tvec4<T, P> const & v);
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tvec4<T, P> operator*(T const & s, tvec4<T, P> const & v);
|
||||
GLM_FUNC_DECL tvec4<T, P> operator-(tvec4<T, P> const & v1, tvec4<T, P> const & v2);
|
||||
|
||||
template <typename T, precision P>
|
||||
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);
|
||||
|
||||
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);
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tvec4<T, P> operator*(tvec4<T, P> const & v1, tvec4<T, P> const & v2);
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tvec4<T, P> operator/(tvec4<T, P> const & v, T const & s);
|
||||
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/(T const & s, tvec4<T, P> const & v);
|
||||
GLM_FUNC_DECL tvec4<T, P> operator/(tvec4<T, P> const & v, tvec1<T, P> const & s);
|
||||
|
||||
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);
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tvec4<T, P> operator/(tvec4<T, P> const & v1, tvec4<T, P> const & v2);
|
||||
@ -310,67 +429,99 @@ namespace detail
|
||||
GLM_FUNC_DECL bool operator!=(tvec4<T, P> const & v1, tvec4<T, P> const & v2);
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tvec4<T, P> operator%(tvec4<T, P> const & v, T const & s);
|
||||
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%(T const & s, tvec4<T, P> const & v);
|
||||
GLM_FUNC_DECL tvec4<T, P> operator%(tvec4<T, P> const & v, tvec1<T, P> const & s);
|
||||
|
||||
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);
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tvec4<T, P> operator%(tvec4<T, P> const & v1, tvec4<T, P> const & v2);
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tvec4<T, P> operator&(tvec4<T, P> const & v, T const & s);
|
||||
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&(T const & s, tvec4<T, P> const & v);
|
||||
GLM_FUNC_DECL tvec4<T, P> operator&(tvec4<T, P> const & v, tvec1<T, P> const & s);
|
||||
|
||||
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);
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tvec4<T, P> operator&(tvec4<T, P> const & v1, tvec4<T, P> const & v2);
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tvec4<T, P> operator|(tvec4<T, P> const & v, T const & s);
|
||||
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|(T const & s, tvec4<T, P> const & v);
|
||||
GLM_FUNC_DECL tvec4<T, P> operator|(tvec4<T, P> const & v, tvec1<T, P> const & s);
|
||||
|
||||
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);
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tvec4<T, P> operator|(tvec4<T, P> const & v1, tvec4<T, P> const & v2);
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tvec4<T, P> operator^(tvec4<T, P> const & v, T const & s);
|
||||
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^(T const & s, tvec4<T, P> const & v);
|
||||
GLM_FUNC_DECL tvec4<T, P> operator^(tvec4<T, P> const & v, tvec1<T, P> const & s);
|
||||
|
||||
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);
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tvec4<T, P> operator^(tvec4<T, P> const & v1, tvec4<T, P> const & v2);
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tvec4<T, P> operator<<(tvec4<T, P> const & v, T const & s);
|
||||
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<<(T const & s, tvec4<T, P> const & v);
|
||||
GLM_FUNC_DECL tvec4<T, P> operator<<(tvec4<T, P> const & v, tvec1<T, P> const & s);
|
||||
|
||||
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);
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tvec4<T, P> operator<<(tvec4<T, P> const & v1, tvec4<T, P> const & v2);
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tvec4<T, P> operator>>(tvec4<T, P> const & v, T const & s);
|
||||
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>>(T const & s, tvec4<T, P> const & v);
|
||||
GLM_FUNC_DECL tvec4<T, P> operator>>(tvec4<T, P> const & v, tvec1<T, P> const & s);
|
||||
|
||||
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);
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tvec4<T, P> operator>>(tvec4<T, P> const & v1, tvec4<T, P> const & v2);
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tvec4<T, P> operator~(tvec4<T, P> const & v);
|
||||
|
||||
}//namespace detail
|
||||
}//namespace glm
|
||||
|
||||
#ifndef GLM_EXTERNAL_TEMPLATE
|
||||
#include "type_vec4.inl"
|
||||
#endif//GLM_EXTERNAL_TEMPLATE
|
||||
|
||||
#endif//glm_core_type_gentype4
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -12,6 +12,10 @@
|
||||
/// 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
|
||||
@ -21,20 +25,17 @@
|
||||
/// THE SOFTWARE.
|
||||
///
|
||||
/// @ref core
|
||||
/// @file glm/core/hint.hpp
|
||||
/// @date 2008-08-14 / 2011-06-15
|
||||
/// @file glm/detail/type_tvec4_avx.inl
|
||||
/// @date 2014-12-01 / 2014-12-01
|
||||
/// @author Christophe Riccio
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef glm_core_type
|
||||
#define glm_core_type
|
||||
|
||||
namespace glm
|
||||
namespace glm{
|
||||
namespace detail
|
||||
{
|
||||
// Use dont_care, nicest and fastest to optimize implementations.
|
||||
class dont_care {};
|
||||
class nicest {};
|
||||
class fastest {};
|
||||
}//namespace glm
|
||||
|
||||
#endif//glm_core_type
|
||||
}//namespace detail
|
||||
|
||||
|
||||
|
||||
}//namespace glm
|
||||
@ -12,6 +12,10 @@
|
||||
/// 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
|
||||
@ -19,8 +23,19 @@
|
||||
/// 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/type_tvec4_avx2.inl
|
||||
/// @date 2014-12-01 / 2014-12-01
|
||||
/// @author Christophe Riccio
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#if(defined(GLM_MESSAGES))
|
||||
# pragma message("GLM: GLM_GTX_unsigned_int extension is deprecated, include GLM_GTX_integer instead")
|
||||
#endif
|
||||
namespace glm{
|
||||
namespace detail
|
||||
{
|
||||
|
||||
}//namespace detail
|
||||
|
||||
|
||||
|
||||
}//namespace glm
|
||||
120
common/glm/glm/detail/type_vec4_sse2.inl
Normal file
120
common/glm/glm/detail/type_vec4_sse2.inl
Normal file
@ -0,0 +1,120 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
/// OpenGL Mathematics (glm.g-truc.net)
|
||||
///
|
||||
/// Copyright (c) 2005 - 2014 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/type_tvec4_sse2.inl
|
||||
/// @date 2014-12-01 / 2014-12-01
|
||||
/// @author Christophe Riccio
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
namespace glm{
|
||||
namespace detail
|
||||
{
|
||||
|
||||
}//namespace detail
|
||||
|
||||
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()
|
||||
# ifndef GLM_FORCE_NO_CTOR_INIT
|
||||
: data(_mm_setzero_ps())
|
||||
# endif
|
||||
{}
|
||||
|
||||
template <>
|
||||
GLM_FUNC_QUALIFIER tvec4<float, lowp>::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) :
|
||||
data(_mm_set_ps(d, c, b, a))
|
||||
{}
|
||||
|
||||
template <>
|
||||
template <typename U>
|
||||
GLM_FUNC_QUALIFIER tvec4<float, lowp> & tvec4<float, lowp>::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, lowp> & tvec4<float, lowp>::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, 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)
|
||||
{
|
||||
this->data = _mm_add_ps(this->data, _mm_set_ps1(static_cast<float>(v.x)));
|
||||
return *this;
|
||||
}
|
||||
}//namespace glm
|
||||
@ -12,6 +12,10 @@
|
||||
/// 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
|
||||
@ -26,9 +30,6 @@
|
||||
/// @author Christophe Riccio
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef GLM_EXPONENTIAL_INCLUDED
|
||||
#define GLM_EXPONENTIAL_INCLUDED
|
||||
#pragma once
|
||||
|
||||
#include "detail/func_exponential.hpp"
|
||||
|
||||
#endif//GLM_EXPONENTIAL_INCLUDED
|
||||
|
||||
@ -12,6 +12,10 @@
|
||||
/// 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
|
||||
@ -48,23 +52,19 @@
|
||||
/// Even if it's highly unrecommended, it's possible to include all the extensions
|
||||
/// at once by including <glm/ext.hpp>. Otherwise, each extension needs to be
|
||||
/// included a specific file.
|
||||
///
|
||||
/// @defgroup virtrev VIRTREV Extensions
|
||||
///
|
||||
/// @brief Extensions develop and maintain by Mathieu [matrem] Roumillac
|
||||
/// (http://www.opengl.org/discussion_boards/ubbthreads.php?ubb=showprofile&User=22660).
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef GLM_EXT_INCLUDED
|
||||
#define GLM_EXT_INCLUDED
|
||||
#pragma once
|
||||
|
||||
#if(defined(GLM_MESSAGES) && !defined(GLM_MESSAGE_EXT_INCLUDED_DISPLAYED))
|
||||
# define GLM_MESSAGE_EXT_INCLUDED_DISPLAYED
|
||||
# pragma message("GLM: All extensions included (not recommanded)")
|
||||
#endif//GLM_MESSAGES
|
||||
|
||||
#include "./gtc/bitfield.hpp"
|
||||
#include "./gtc/constants.hpp"
|
||||
#include "./gtc/epsilon.hpp"
|
||||
#include "./gtc/integer.hpp"
|
||||
#include "./gtc/matrix_access.hpp"
|
||||
#include "./gtc/matrix_integer.hpp"
|
||||
#include "./gtc/matrix_inverse.hpp"
|
||||
@ -74,9 +74,11 @@
|
||||
#include "./gtc/quaternion.hpp"
|
||||
#include "./gtc/random.hpp"
|
||||
#include "./gtc/reciprocal.hpp"
|
||||
#include "./gtc/round.hpp"
|
||||
#include "./gtc/type_precision.hpp"
|
||||
#include "./gtc/type_ptr.hpp"
|
||||
#include "./gtc/ulp.hpp"
|
||||
#include "./gtc/vec1.hpp"
|
||||
|
||||
#include "./gtx/associated_min_max.hpp"
|
||||
#include "./gtx/bit.hpp"
|
||||
@ -94,8 +96,6 @@
|
||||
#include "./gtx/fast_trigonometry.hpp"
|
||||
#include "./gtx/gradient_paint.hpp"
|
||||
#include "./gtx/handed_coordinate_space.hpp"
|
||||
#include "./gtx/inertia.hpp"
|
||||
#include "./gtx/int_10_10_10_2.hpp"
|
||||
#include "./gtx/integer.hpp"
|
||||
#include "./gtx/intersect.hpp"
|
||||
#include "./gtx/log_base.hpp"
|
||||
@ -105,7 +105,6 @@
|
||||
#include "./gtx/matrix_operation.hpp"
|
||||
#include "./gtx/matrix_query.hpp"
|
||||
#include "./gtx/mixed_product.hpp"
|
||||
#include "./gtx/multiple.hpp"
|
||||
#include "./gtx/norm.hpp"
|
||||
#include "./gtx/normal.hpp"
|
||||
#include "./gtx/normalize_dot.hpp"
|
||||
@ -120,19 +119,25 @@
|
||||
#include "./gtx/rotate_vector.hpp"
|
||||
#include "./gtx/spline.hpp"
|
||||
#include "./gtx/std_based_type.hpp"
|
||||
#if(!(GLM_COMPILER & GLM_COMPILER_CUDA))
|
||||
#if !(GLM_COMPILER & GLM_COMPILER_CUDA)
|
||||
# include "./gtx/string_cast.hpp"
|
||||
#endif
|
||||
#include "./gtx/transform.hpp"
|
||||
#include "./gtx/transform2.hpp"
|
||||
#include "./gtx/vec1.hpp"
|
||||
#include "./gtx/type_aligned.hpp"
|
||||
#include "./gtx/vector_angle.hpp"
|
||||
#include "./gtx/vector_query.hpp"
|
||||
#include "./gtx/wrap.hpp"
|
||||
|
||||
#if(GLM_ARCH & GLM_ARCH_SSE2)
|
||||
#if GLM_HAS_TEMPLATE_ALIASES
|
||||
# include "./gtx/scalar_multiplication.hpp"
|
||||
#endif
|
||||
|
||||
#if GLM_HAS_RANGE_FOR
|
||||
# include "./gtx/range.hpp"
|
||||
#endif
|
||||
|
||||
#if GLM_ARCH & GLM_ARCH_SSE2
|
||||
# include "./gtx/simd_vec4.hpp"
|
||||
# include "./gtx/simd_mat4.hpp"
|
||||
#endif
|
||||
|
||||
#endif //GLM_EXT_INCLUDED
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -12,6 +12,10 @@
|
||||
/// 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
|
||||
@ -26,9 +30,6 @@
|
||||
/// @author Christophe Riccio
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef GLM_GEOMETRIC_INCLUDED
|
||||
#define GLM_GEOMETRIC_INCLUDED
|
||||
#pragma once
|
||||
|
||||
#include "detail/func_geometric.hpp"
|
||||
|
||||
#endif//GLM_GEOMETRIC_INCLUDED
|
||||
|
||||
@ -12,6 +12,10 @@
|
||||
/// 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
|
||||
@ -25,9 +29,9 @@
|
||||
/// @date 2005-01-14 / 2011-10-24
|
||||
/// @author Christophe Riccio
|
||||
///
|
||||
/// @defgroup core GLM Core
|
||||
///
|
||||
/// @brief The core of GLM, which implements exactly and only the GLSL specification to the degree possible.
|
||||
/// @defgroup core GLM Core
|
||||
///
|
||||
/// @brief The core of GLM, which implements exactly and only the GLSL specification to the degree possible.
|
||||
///
|
||||
/// The GLM core consists of @ref core_types "C++ types that mirror GLSL types" and
|
||||
/// C++ functions that mirror the GLSL functions. It also includes
|
||||
@ -37,7 +41,6 @@
|
||||
/// The best documentation for GLM Core is the current GLSL specification,
|
||||
/// <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.clean.pdf">version 4.2
|
||||
/// (pdf file)</a>.
|
||||
/// There are a few @ref pg_differences "differences" between GLM core and GLSL.
|
||||
///
|
||||
/// GLM core functionnalities require <glm/glm.hpp> to be included to be used.
|
||||
///
|
||||
@ -77,8 +80,7 @@
|
||||
|
||||
#include "detail/_fixes.hpp"
|
||||
|
||||
#ifndef GLM_INCLUDED
|
||||
#define GLM_INCLUDED
|
||||
#pragma once
|
||||
|
||||
#include <cmath>
|
||||
#include <climits>
|
||||
@ -113,5 +115,3 @@
|
||||
#include "matrix.hpp"
|
||||
#include "vector_relational.hpp"
|
||||
#include "integer.hpp"
|
||||
|
||||
#endif//GLM_INCLUDED
|
||||
|
||||
236
common/glm/glm/gtc/bitfield.hpp
Normal file
236
common/glm/glm/gtc/bitfield.hpp
Normal file
@ -0,0 +1,236 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
/// OpenGL Mathematics (glm.g-truc.net)
|
||||
///
|
||||
/// Copyright (c) 2005 - 2014 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 gtc_bitfield
|
||||
/// @file glm/gtc/bitfield.hpp
|
||||
/// @date 2014-10-25 / 2014-10-25
|
||||
/// @author Christophe Riccio
|
||||
///
|
||||
/// @see core (dependence)
|
||||
/// @see gtc_bitfield (dependence)
|
||||
///
|
||||
/// @defgroup gtc_bitfield GLM_GTC_bitfield
|
||||
/// @ingroup gtc
|
||||
///
|
||||
/// @brief Allow to perform bit operations on integer values
|
||||
///
|
||||
/// <glm/gtc/bitfield.hpp> need to be included to use these functionalities.
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
// Dependencies
|
||||
#include "../detail/setup.hpp"
|
||||
#include "../detail/precision.hpp"
|
||||
#include "../detail/type_int.hpp"
|
||||
#include "../detail/_vectorize.hpp"
|
||||
#include <limits>
|
||||
|
||||
#if(defined(GLM_MESSAGES) && !defined(GLM_EXT_INCLUDED))
|
||||
# pragma message("GLM: GLM_GTC_bitfield extension included")
|
||||
#endif
|
||||
|
||||
namespace glm
|
||||
{
|
||||
/// @addtogroup gtc_bitfield
|
||||
/// @{
|
||||
|
||||
/// Build a mask of 'count' bits
|
||||
///
|
||||
/// @see gtc_bitfield
|
||||
template <typename genIUType>
|
||||
GLM_FUNC_DECL genIUType mask(genIUType Bits);
|
||||
|
||||
/// Build a mask of 'count' bits
|
||||
///
|
||||
/// @see gtc_bitfield
|
||||
template <typename T, precision P, template <typename, precision> class vecIUType>
|
||||
GLM_FUNC_DECL vecIUType<T, P> mask(vecIUType<T, P> const & v);
|
||||
|
||||
/// Rotate all bits to the right. All the bits dropped in the right side are inserted back on the left side.
|
||||
///
|
||||
/// @see gtc_bitfield
|
||||
template <typename genIUType>
|
||||
GLM_FUNC_DECL genIUType bitfieldRotateRight(genIUType In, int Shift);
|
||||
|
||||
/// Rotate all bits to the right. All the bits dropped in the right side are inserted back on the left side.
|
||||
///
|
||||
/// @see gtc_bitfield
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<T, P> bitfieldRotateRight(vecType<T, P> const & In, int Shift);
|
||||
|
||||
/// Rotate all bits to the left. All the bits dropped in the left side are inserted back on the right side.
|
||||
///
|
||||
/// @see gtc_bitfield
|
||||
template <typename genIUType>
|
||||
GLM_FUNC_DECL genIUType bitfieldRotateLeft(genIUType In, int Shift);
|
||||
|
||||
/// Rotate all bits to the left. All the bits dropped in the left side are inserted back on the right side.
|
||||
///
|
||||
/// @see gtc_bitfield
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<T, P> bitfieldRotateLeft(vecType<T, P> const & In, int Shift);
|
||||
|
||||
/// Set to 1 a range of bits.
|
||||
///
|
||||
/// @see gtc_bitfield
|
||||
template <typename genIUType>
|
||||
GLM_FUNC_DECL genIUType bitfieldFillOne(genIUType Value, int FirstBit, int BitCount);
|
||||
|
||||
/// Set to 1 a range of bits.
|
||||
///
|
||||
/// @see gtc_bitfield
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<T, P> bitfieldFillOne(vecType<T, P> const & Value, int FirstBit, int BitCount);
|
||||
|
||||
/// Set to 0 a range of bits.
|
||||
///
|
||||
/// @see gtc_bitfield
|
||||
template <typename genIUType>
|
||||
GLM_FUNC_DECL genIUType bitfieldFillZero(genIUType Value, int FirstBit, int BitCount);
|
||||
|
||||
/// Set to 0 a range of bits.
|
||||
///
|
||||
/// @see gtc_bitfield
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<T, P> bitfieldFillZero(vecType<T, P> const & Value, int FirstBit, int BitCount);
|
||||
|
||||
/// Interleaves the bits of x and y.
|
||||
/// The first bit is the first bit of x followed by the first bit of y.
|
||||
/// The other bits are interleaved following the previous sequence.
|
||||
///
|
||||
/// @see gtc_bitfield
|
||||
GLM_FUNC_DECL int16 bitfieldInterleave(int8 x, int8 y);
|
||||
|
||||
/// Interleaves the bits of x and y.
|
||||
/// The first bit is the first bit of x followed by the first bit of y.
|
||||
/// The other bits are interleaved following the previous sequence.
|
||||
///
|
||||
/// @see gtc_bitfield
|
||||
GLM_FUNC_DECL uint16 bitfieldInterleave(uint8 x, uint8 y);
|
||||
|
||||
/// Interleaves the bits of x and y.
|
||||
/// The first bit is the first bit of x followed by the first bit of y.
|
||||
/// The other bits are interleaved following the previous sequence.
|
||||
///
|
||||
/// @see gtc_bitfield
|
||||
GLM_FUNC_DECL int32 bitfieldInterleave(int16 x, int16 y);
|
||||
|
||||
/// Interleaves the bits of x and y.
|
||||
/// The first bit is the first bit of x followed by the first bit of y.
|
||||
/// The other bits are interleaved following the previous sequence.
|
||||
///
|
||||
/// @see gtc_bitfield
|
||||
GLM_FUNC_DECL uint32 bitfieldInterleave(uint16 x, uint16 y);
|
||||
|
||||
/// Interleaves the bits of x and y.
|
||||
/// The first bit is the first bit of x followed by the first bit of y.
|
||||
/// The other bits are interleaved following the previous sequence.
|
||||
///
|
||||
/// @see gtc_bitfield
|
||||
GLM_FUNC_DECL int64 bitfieldInterleave(int32 x, int32 y);
|
||||
|
||||
/// Interleaves the bits of x and y.
|
||||
/// The first bit is the first bit of x followed by the first bit of y.
|
||||
/// The other bits are interleaved following the previous sequence.
|
||||
///
|
||||
/// @see gtc_bitfield
|
||||
GLM_FUNC_DECL uint64 bitfieldInterleave(uint32 x, uint32 y);
|
||||
|
||||
/// Interleaves the bits of x, y and z.
|
||||
/// The first bit is the first bit of x followed by the first bit of y and the first bit of z.
|
||||
/// The other bits are interleaved following the previous sequence.
|
||||
///
|
||||
/// @see gtc_bitfield
|
||||
GLM_FUNC_DECL int32 bitfieldInterleave(int8 x, int8 y, int8 z);
|
||||
|
||||
/// Interleaves the bits of x, y and z.
|
||||
/// The first bit is the first bit of x followed by the first bit of y and the first bit of z.
|
||||
/// The other bits are interleaved following the previous sequence.
|
||||
///
|
||||
/// @see gtc_bitfield
|
||||
GLM_FUNC_DECL uint32 bitfieldInterleave(uint8 x, uint8 y, uint8 z);
|
||||
|
||||
/// Interleaves the bits of x, y and z.
|
||||
/// The first bit is the first bit of x followed by the first bit of y and the first bit of z.
|
||||
/// The other bits are interleaved following the previous sequence.
|
||||
///
|
||||
/// @see gtc_bitfield
|
||||
GLM_FUNC_DECL int64 bitfieldInterleave(int16 x, int16 y, int16 z);
|
||||
|
||||
/// Interleaves the bits of x, y and z.
|
||||
/// The first bit is the first bit of x followed by the first bit of y and the first bit of z.
|
||||
/// The other bits are interleaved following the previous sequence.
|
||||
///
|
||||
/// @see gtc_bitfield
|
||||
GLM_FUNC_DECL uint64 bitfieldInterleave(uint16 x, uint16 y, uint16 z);
|
||||
|
||||
/// Interleaves the bits of x, y and z.
|
||||
/// The first bit is the first bit of x followed by the first bit of y and the first bit of z.
|
||||
/// The other bits are interleaved following the previous sequence.
|
||||
///
|
||||
/// @see gtc_bitfield
|
||||
GLM_FUNC_DECL int64 bitfieldInterleave(int32 x, int32 y, int32 z);
|
||||
|
||||
/// Interleaves the bits of x, y and z.
|
||||
/// The first bit is the first bit of x followed by the first bit of y and the first bit of z.
|
||||
/// The other bits are interleaved following the previous sequence.
|
||||
///
|
||||
/// @see gtc_bitfield
|
||||
GLM_FUNC_DECL uint64 bitfieldInterleave(uint32 x, uint32 y, uint32 z);
|
||||
|
||||
/// Interleaves the bits of x, y, z and w.
|
||||
/// The first bit is the first bit of x followed by the first bit of y, the first bit of z and finally the first bit of w.
|
||||
/// The other bits are interleaved following the previous sequence.
|
||||
///
|
||||
/// @see gtc_bitfield
|
||||
GLM_FUNC_DECL int32 bitfieldInterleave(int8 x, int8 y, int8 z, int8 w);
|
||||
|
||||
/// Interleaves the bits of x, y, z and w.
|
||||
/// The first bit is the first bit of x followed by the first bit of y, the first bit of z and finally the first bit of w.
|
||||
/// The other bits are interleaved following the previous sequence.
|
||||
///
|
||||
/// @see gtc_bitfield
|
||||
GLM_FUNC_DECL uint32 bitfieldInterleave(uint8 x, uint8 y, uint8 z, uint8 w);
|
||||
|
||||
/// Interleaves the bits of x, y, z and w.
|
||||
/// The first bit is the first bit of x followed by the first bit of y, the first bit of z and finally the first bit of w.
|
||||
/// The other bits are interleaved following the previous sequence.
|
||||
///
|
||||
/// @see gtc_bitfield
|
||||
GLM_FUNC_DECL int64 bitfieldInterleave(int16 x, int16 y, int16 z, int16 w);
|
||||
|
||||
/// Interleaves the bits of x, y, z and w.
|
||||
/// The first bit is the first bit of x followed by the first bit of y, the first bit of z and finally the first bit of w.
|
||||
/// The other bits are interleaved following the previous sequence.
|
||||
///
|
||||
/// @see gtc_bitfield
|
||||
GLM_FUNC_DECL uint64 bitfieldInterleave(uint16 x, uint16 y, uint16 z, uint16 w);
|
||||
|
||||
/// @}
|
||||
} //namespace glm
|
||||
|
||||
#include "bitfield.inl"
|
||||
542
common/glm/glm/gtc/bitfield.inl
Normal file
542
common/glm/glm/gtc/bitfield.inl
Normal file
@ -0,0 +1,542 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
/// OpenGL Mathematics (glm.g-truc.net)
|
||||
///
|
||||
/// Copyright (c) 2005 - 2014 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 gtc_bitfield
|
||||
/// @file glm/gtc/bitfield.inl
|
||||
/// @date 2011-10-14 / 2012-01-25
|
||||
/// @author Christophe Riccio
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
namespace glm{
|
||||
namespace detail
|
||||
{
|
||||
template <typename PARAM, typename RET>
|
||||
GLM_FUNC_DECL RET bitfieldInterleave(PARAM x, PARAM y);
|
||||
|
||||
template <typename PARAM, typename RET>
|
||||
GLM_FUNC_DECL RET bitfieldInterleave(PARAM x, PARAM y, PARAM z);
|
||||
|
||||
template <typename PARAM, typename RET>
|
||||
GLM_FUNC_DECL RET bitfieldInterleave(PARAM x, PARAM y, PARAM z, PARAM w);
|
||||
|
||||
template <>
|
||||
GLM_FUNC_QUALIFIER glm::uint16 bitfieldInterleave(glm::uint8 x, glm::uint8 y)
|
||||
{
|
||||
glm::uint16 REG1(x);
|
||||
glm::uint16 REG2(y);
|
||||
|
||||
REG1 = ((REG1 << 4) | REG1) & glm::uint16(0x0F0F);
|
||||
REG2 = ((REG2 << 4) | REG2) & glm::uint16(0x0F0F);
|
||||
|
||||
REG1 = ((REG1 << 2) | REG1) & glm::uint16(0x3333);
|
||||
REG2 = ((REG2 << 2) | REG2) & glm::uint16(0x3333);
|
||||
|
||||
REG1 = ((REG1 << 1) | REG1) & glm::uint16(0x5555);
|
||||
REG2 = ((REG2 << 1) | REG2) & glm::uint16(0x5555);
|
||||
|
||||
return REG1 | (REG2 << 1);
|
||||
}
|
||||
|
||||
template <>
|
||||
GLM_FUNC_QUALIFIER glm::uint32 bitfieldInterleave(glm::uint16 x, glm::uint16 y)
|
||||
{
|
||||
glm::uint32 REG1(x);
|
||||
glm::uint32 REG2(y);
|
||||
|
||||
REG1 = ((REG1 << 8) | REG1) & glm::uint32(0x00FF00FF);
|
||||
REG2 = ((REG2 << 8) | REG2) & glm::uint32(0x00FF00FF);
|
||||
|
||||
REG1 = ((REG1 << 4) | REG1) & glm::uint32(0x0F0F0F0F);
|
||||
REG2 = ((REG2 << 4) | REG2) & glm::uint32(0x0F0F0F0F);
|
||||
|
||||
REG1 = ((REG1 << 2) | REG1) & glm::uint32(0x33333333);
|
||||
REG2 = ((REG2 << 2) | REG2) & glm::uint32(0x33333333);
|
||||
|
||||
REG1 = ((REG1 << 1) | REG1) & glm::uint32(0x55555555);
|
||||
REG2 = ((REG2 << 1) | REG2) & glm::uint32(0x55555555);
|
||||
|
||||
return REG1 | (REG2 << 1);
|
||||
}
|
||||
|
||||
template <>
|
||||
GLM_FUNC_QUALIFIER glm::uint64 bitfieldInterleave(glm::uint32 x, glm::uint32 y)
|
||||
{
|
||||
glm::uint64 REG1(x);
|
||||
glm::uint64 REG2(y);
|
||||
|
||||
REG1 = ((REG1 << 16) | REG1) & glm::uint64(0x0000FFFF0000FFFF);
|
||||
REG2 = ((REG2 << 16) | REG2) & glm::uint64(0x0000FFFF0000FFFF);
|
||||
|
||||
REG1 = ((REG1 << 8) | REG1) & glm::uint64(0x00FF00FF00FF00FF);
|
||||
REG2 = ((REG2 << 8) | REG2) & glm::uint64(0x00FF00FF00FF00FF);
|
||||
|
||||
REG1 = ((REG1 << 4) | REG1) & glm::uint64(0x0F0F0F0F0F0F0F0F);
|
||||
REG2 = ((REG2 << 4) | REG2) & glm::uint64(0x0F0F0F0F0F0F0F0F);
|
||||
|
||||
REG1 = ((REG1 << 2) | REG1) & glm::uint64(0x3333333333333333);
|
||||
REG2 = ((REG2 << 2) | REG2) & glm::uint64(0x3333333333333333);
|
||||
|
||||
REG1 = ((REG1 << 1) | REG1) & glm::uint64(0x5555555555555555);
|
||||
REG2 = ((REG2 << 1) | REG2) & glm::uint64(0x5555555555555555);
|
||||
|
||||
return REG1 | (REG2 << 1);
|
||||
}
|
||||
|
||||
template <>
|
||||
GLM_FUNC_QUALIFIER glm::uint32 bitfieldInterleave(glm::uint8 x, glm::uint8 y, glm::uint8 z)
|
||||
{
|
||||
glm::uint32 REG1(x);
|
||||
glm::uint32 REG2(y);
|
||||
glm::uint32 REG3(z);
|
||||
|
||||
REG1 = ((REG1 << 16) | REG1) & glm::uint32(0x00FF0000FF0000FF);
|
||||
REG2 = ((REG2 << 16) | REG2) & glm::uint32(0x00FF0000FF0000FF);
|
||||
REG3 = ((REG3 << 16) | REG3) & glm::uint32(0x00FF0000FF0000FF);
|
||||
|
||||
REG1 = ((REG1 << 8) | REG1) & glm::uint32(0xF00F00F00F00F00F);
|
||||
REG2 = ((REG2 << 8) | REG2) & glm::uint32(0xF00F00F00F00F00F);
|
||||
REG3 = ((REG3 << 8) | REG3) & glm::uint32(0xF00F00F00F00F00F);
|
||||
|
||||
REG1 = ((REG1 << 4) | REG1) & glm::uint32(0x30C30C30C30C30C3);
|
||||
REG2 = ((REG2 << 4) | REG2) & glm::uint32(0x30C30C30C30C30C3);
|
||||
REG3 = ((REG3 << 4) | REG3) & glm::uint32(0x30C30C30C30C30C3);
|
||||
|
||||
REG1 = ((REG1 << 2) | REG1) & glm::uint32(0x9249249249249249);
|
||||
REG2 = ((REG2 << 2) | REG2) & glm::uint32(0x9249249249249249);
|
||||
REG3 = ((REG3 << 2) | REG3) & glm::uint32(0x9249249249249249);
|
||||
|
||||
return REG1 | (REG2 << 1) | (REG3 << 2);
|
||||
}
|
||||
|
||||
template <>
|
||||
GLM_FUNC_QUALIFIER glm::uint64 bitfieldInterleave(glm::uint16 x, glm::uint16 y, glm::uint16 z)
|
||||
{
|
||||
glm::uint64 REG1(x);
|
||||
glm::uint64 REG2(y);
|
||||
glm::uint64 REG3(z);
|
||||
|
||||
REG1 = ((REG1 << 32) | REG1) & glm::uint64(0xFFFF00000000FFFF);
|
||||
REG2 = ((REG2 << 32) | REG2) & glm::uint64(0xFFFF00000000FFFF);
|
||||
REG3 = ((REG3 << 32) | REG3) & glm::uint64(0xFFFF00000000FFFF);
|
||||
|
||||
REG1 = ((REG1 << 16) | REG1) & glm::uint64(0x00FF0000FF0000FF);
|
||||
REG2 = ((REG2 << 16) | REG2) & glm::uint64(0x00FF0000FF0000FF);
|
||||
REG3 = ((REG3 << 16) | REG3) & glm::uint64(0x00FF0000FF0000FF);
|
||||
|
||||
REG1 = ((REG1 << 8) | REG1) & glm::uint64(0xF00F00F00F00F00F);
|
||||
REG2 = ((REG2 << 8) | REG2) & glm::uint64(0xF00F00F00F00F00F);
|
||||
REG3 = ((REG3 << 8) | REG3) & glm::uint64(0xF00F00F00F00F00F);
|
||||
|
||||
REG1 = ((REG1 << 4) | REG1) & glm::uint64(0x30C30C30C30C30C3);
|
||||
REG2 = ((REG2 << 4) | REG2) & glm::uint64(0x30C30C30C30C30C3);
|
||||
REG3 = ((REG3 << 4) | REG3) & glm::uint64(0x30C30C30C30C30C3);
|
||||
|
||||
REG1 = ((REG1 << 2) | REG1) & glm::uint64(0x9249249249249249);
|
||||
REG2 = ((REG2 << 2) | REG2) & glm::uint64(0x9249249249249249);
|
||||
REG3 = ((REG3 << 2) | REG3) & glm::uint64(0x9249249249249249);
|
||||
|
||||
return REG1 | (REG2 << 1) | (REG3 << 2);
|
||||
}
|
||||
|
||||
template <>
|
||||
GLM_FUNC_QUALIFIER glm::uint64 bitfieldInterleave(glm::uint32 x, glm::uint32 y, glm::uint32 z)
|
||||
{
|
||||
glm::uint64 REG1(x);
|
||||
glm::uint64 REG2(y);
|
||||
glm::uint64 REG3(z);
|
||||
|
||||
REG1 = ((REG1 << 32) | REG1) & glm::uint64(0xFFFF00000000FFFF);
|
||||
REG2 = ((REG2 << 32) | REG2) & glm::uint64(0xFFFF00000000FFFF);
|
||||
REG3 = ((REG3 << 32) | REG3) & glm::uint64(0xFFFF00000000FFFF);
|
||||
|
||||
REG1 = ((REG1 << 16) | REG1) & glm::uint64(0x00FF0000FF0000FF);
|
||||
REG2 = ((REG2 << 16) | REG2) & glm::uint64(0x00FF0000FF0000FF);
|
||||
REG3 = ((REG3 << 16) | REG3) & glm::uint64(0x00FF0000FF0000FF);
|
||||
|
||||
REG1 = ((REG1 << 8) | REG1) & glm::uint64(0xF00F00F00F00F00F);
|
||||
REG2 = ((REG2 << 8) | REG2) & glm::uint64(0xF00F00F00F00F00F);
|
||||
REG3 = ((REG3 << 8) | REG3) & glm::uint64(0xF00F00F00F00F00F);
|
||||
|
||||
REG1 = ((REG1 << 4) | REG1) & glm::uint64(0x30C30C30C30C30C3);
|
||||
REG2 = ((REG2 << 4) | REG2) & glm::uint64(0x30C30C30C30C30C3);
|
||||
REG3 = ((REG3 << 4) | REG3) & glm::uint64(0x30C30C30C30C30C3);
|
||||
|
||||
REG1 = ((REG1 << 2) | REG1) & glm::uint64(0x9249249249249249);
|
||||
REG2 = ((REG2 << 2) | REG2) & glm::uint64(0x9249249249249249);
|
||||
REG3 = ((REG3 << 2) | REG3) & glm::uint64(0x9249249249249249);
|
||||
|
||||
return REG1 | (REG2 << 1) | (REG3 << 2);
|
||||
}
|
||||
|
||||
template <>
|
||||
GLM_FUNC_QUALIFIER glm::uint32 bitfieldInterleave(glm::uint8 x, glm::uint8 y, glm::uint8 z, glm::uint8 w)
|
||||
{
|
||||
glm::uint32 REG1(x);
|
||||
glm::uint32 REG2(y);
|
||||
glm::uint32 REG3(z);
|
||||
glm::uint32 REG4(w);
|
||||
|
||||
REG1 = ((REG1 << 12) | REG1) & glm::uint32(0x000F000F000F000F);
|
||||
REG2 = ((REG2 << 12) | REG2) & glm::uint32(0x000F000F000F000F);
|
||||
REG3 = ((REG3 << 12) | REG3) & glm::uint32(0x000F000F000F000F);
|
||||
REG4 = ((REG4 << 12) | REG4) & glm::uint32(0x000F000F000F000F);
|
||||
|
||||
REG1 = ((REG1 << 6) | REG1) & glm::uint32(0x0303030303030303);
|
||||
REG2 = ((REG2 << 6) | REG2) & glm::uint32(0x0303030303030303);
|
||||
REG3 = ((REG3 << 6) | REG3) & glm::uint32(0x0303030303030303);
|
||||
REG4 = ((REG4 << 6) | REG4) & glm::uint32(0x0303030303030303);
|
||||
|
||||
REG1 = ((REG1 << 3) | REG1) & glm::uint32(0x1111111111111111);
|
||||
REG2 = ((REG2 << 3) | REG2) & glm::uint32(0x1111111111111111);
|
||||
REG3 = ((REG3 << 3) | REG3) & glm::uint32(0x1111111111111111);
|
||||
REG4 = ((REG4 << 3) | REG4) & glm::uint32(0x1111111111111111);
|
||||
|
||||
return REG1 | (REG2 << 1) | (REG3 << 2) | (REG4 << 3);
|
||||
}
|
||||
|
||||
template <>
|
||||
GLM_FUNC_QUALIFIER glm::uint64 bitfieldInterleave(glm::uint16 x, glm::uint16 y, glm::uint16 z, glm::uint16 w)
|
||||
{
|
||||
glm::uint64 REG1(x);
|
||||
glm::uint64 REG2(y);
|
||||
glm::uint64 REG3(z);
|
||||
glm::uint64 REG4(w);
|
||||
|
||||
REG1 = ((REG1 << 24) | REG1) & glm::uint64(0x000000FF000000FF);
|
||||
REG2 = ((REG2 << 24) | REG2) & glm::uint64(0x000000FF000000FF);
|
||||
REG3 = ((REG3 << 24) | REG3) & glm::uint64(0x000000FF000000FF);
|
||||
REG4 = ((REG4 << 24) | REG4) & glm::uint64(0x000000FF000000FF);
|
||||
|
||||
REG1 = ((REG1 << 12) | REG1) & glm::uint64(0x000F000F000F000F);
|
||||
REG2 = ((REG2 << 12) | REG2) & glm::uint64(0x000F000F000F000F);
|
||||
REG3 = ((REG3 << 12) | REG3) & glm::uint64(0x000F000F000F000F);
|
||||
REG4 = ((REG4 << 12) | REG4) & glm::uint64(0x000F000F000F000F);
|
||||
|
||||
REG1 = ((REG1 << 6) | REG1) & glm::uint64(0x0303030303030303);
|
||||
REG2 = ((REG2 << 6) | REG2) & glm::uint64(0x0303030303030303);
|
||||
REG3 = ((REG3 << 6) | REG3) & glm::uint64(0x0303030303030303);
|
||||
REG4 = ((REG4 << 6) | REG4) & glm::uint64(0x0303030303030303);
|
||||
|
||||
REG1 = ((REG1 << 3) | REG1) & glm::uint64(0x1111111111111111);
|
||||
REG2 = ((REG2 << 3) | REG2) & glm::uint64(0x1111111111111111);
|
||||
REG3 = ((REG3 << 3) | REG3) & glm::uint64(0x1111111111111111);
|
||||
REG4 = ((REG4 << 3) | REG4) & glm::uint64(0x1111111111111111);
|
||||
|
||||
return REG1 | (REG2 << 1) | (REG3 << 2) | (REG4 << 3);
|
||||
}
|
||||
}//namespace detail
|
||||
|
||||
template <typename genIUType>
|
||||
GLM_FUNC_QUALIFIER genIUType mask(genIUType Bits)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genIUType>::is_integer, "'mask' accepts only integer values");
|
||||
|
||||
return Bits >= sizeof(genIUType) * 8 ? ~static_cast<genIUType>(0) : (static_cast<genIUType>(1) << Bits) - static_cast<genIUType>(1);
|
||||
}
|
||||
|
||||
template <typename T, precision P, template <typename, precision> class vecIUType>
|
||||
GLM_FUNC_QUALIFIER vecIUType<T, P> mask(vecIUType<T, P> const & v)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_integer, "'mask' accepts only integer values");
|
||||
|
||||
return detail::functor1<T, T, P, vecIUType>::call(mask, v);
|
||||
}
|
||||
|
||||
template <typename genIType>
|
||||
GLM_FUNC_QUALIFIER genIType bitfieldRotateRight(genIType In, int Shift)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genIType>::is_integer, "'bitfieldRotateRight' accepts only integer values");
|
||||
|
||||
int const BitSize = static_cast<genIType>(sizeof(genIType) * 8);
|
||||
return (In << static_cast<genIType>(Shift)) | (In >> static_cast<genIType>(BitSize - Shift));
|
||||
}
|
||||
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<T, P> bitfieldRotateRight(vecType<T, P> const & In, int Shift)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_integer, "'bitfieldRotateRight' accepts only integer values");
|
||||
|
||||
int const BitSize = static_cast<int>(sizeof(T) * 8);
|
||||
return (In << static_cast<T>(Shift)) | (In >> static_cast<T>(BitSize - Shift));
|
||||
}
|
||||
|
||||
template <typename genIType>
|
||||
GLM_FUNC_QUALIFIER genIType bitfieldRotateLeft(genIType In, int Shift)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genIType>::is_integer, "'bitfieldRotateLeft' accepts only integer values");
|
||||
|
||||
int const BitSize = static_cast<genIType>(sizeof(genIType) * 8);
|
||||
return (In >> static_cast<genIType>(Shift)) | (In << static_cast<genIType>(BitSize - Shift));
|
||||
}
|
||||
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<T, P> bitfieldRotateLeft(vecType<T, P> const & In, int Shift)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_integer, "'bitfieldRotateLeft' accepts only integer values");
|
||||
|
||||
int const BitSize = static_cast<int>(sizeof(T) * 8);
|
||||
return (In >> static_cast<T>(Shift)) | (In << static_cast<T>(BitSize - Shift));
|
||||
}
|
||||
|
||||
template <typename genIUType>
|
||||
GLM_FUNC_QUALIFIER genIUType bitfieldFillOne(genIUType Value, int FirstBit, int BitCount)
|
||||
{
|
||||
return Value | static_cast<genIUType>(mask(BitCount) << FirstBit);
|
||||
}
|
||||
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<T, P> bitfieldFillOne(vecType<T, P> const & Value, int FirstBit, int BitCount)
|
||||
{
|
||||
return Value | static_cast<T>(mask(BitCount) << FirstBit);
|
||||
}
|
||||
|
||||
template <typename genIUType>
|
||||
GLM_FUNC_QUALIFIER genIUType bitfieldFillZero(genIUType Value, int FirstBit, int BitCount)
|
||||
{
|
||||
return Value & static_cast<genIUType>(~(mask(BitCount) << FirstBit));
|
||||
}
|
||||
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<T, P> bitfieldFillZero(vecType<T, P> const & Value, int FirstBit, int BitCount)
|
||||
{
|
||||
return Value & static_cast<T>(~(mask(BitCount) << FirstBit));
|
||||
}
|
||||
|
||||
GLM_FUNC_QUALIFIER int16 bitfieldInterleave(int8 x, int8 y)
|
||||
{
|
||||
union sign8
|
||||
{
|
||||
int8 i;
|
||||
uint8 u;
|
||||
} sign_x, sign_y;
|
||||
|
||||
union sign16
|
||||
{
|
||||
int16 i;
|
||||
uint16 u;
|
||||
} result;
|
||||
|
||||
sign_x.i = x;
|
||||
sign_y.i = y;
|
||||
result.u = bitfieldInterleave(sign_x.u, sign_y.u);
|
||||
|
||||
return result.i;
|
||||
}
|
||||
|
||||
GLM_FUNC_QUALIFIER uint16 bitfieldInterleave(uint8 x, uint8 y)
|
||||
{
|
||||
return detail::bitfieldInterleave<uint8, uint16>(x, y);
|
||||
}
|
||||
|
||||
GLM_FUNC_QUALIFIER int32 bitfieldInterleave(int16 x, int16 y)
|
||||
{
|
||||
union sign16
|
||||
{
|
||||
int16 i;
|
||||
uint16 u;
|
||||
} sign_x, sign_y;
|
||||
|
||||
union sign32
|
||||
{
|
||||
int32 i;
|
||||
uint32 u;
|
||||
} result;
|
||||
|
||||
sign_x.i = x;
|
||||
sign_y.i = y;
|
||||
result.u = bitfieldInterleave(sign_x.u, sign_y.u);
|
||||
|
||||
return result.i;
|
||||
}
|
||||
|
||||
GLM_FUNC_QUALIFIER uint32 bitfieldInterleave(uint16 x, uint16 y)
|
||||
{
|
||||
return detail::bitfieldInterleave<uint16, uint32>(x, y);
|
||||
}
|
||||
|
||||
GLM_FUNC_QUALIFIER int64 bitfieldInterleave(int32 x, int32 y)
|
||||
{
|
||||
union sign32
|
||||
{
|
||||
int32 i;
|
||||
uint32 u;
|
||||
} sign_x, sign_y;
|
||||
|
||||
union sign64
|
||||
{
|
||||
int64 i;
|
||||
uint64 u;
|
||||
} result;
|
||||
|
||||
sign_x.i = x;
|
||||
sign_y.i = y;
|
||||
result.u = bitfieldInterleave(sign_x.u, sign_y.u);
|
||||
|
||||
return result.i;
|
||||
}
|
||||
|
||||
GLM_FUNC_QUALIFIER uint64 bitfieldInterleave(uint32 x, uint32 y)
|
||||
{
|
||||
return detail::bitfieldInterleave<uint32, uint64>(x, y);
|
||||
}
|
||||
|
||||
GLM_FUNC_QUALIFIER int32 bitfieldInterleave(int8 x, int8 y, int8 z)
|
||||
{
|
||||
union sign8
|
||||
{
|
||||
int8 i;
|
||||
uint8 u;
|
||||
} sign_x, sign_y, sign_z;
|
||||
|
||||
union sign32
|
||||
{
|
||||
int32 i;
|
||||
uint32 u;
|
||||
} result;
|
||||
|
||||
sign_x.i = x;
|
||||
sign_y.i = y;
|
||||
sign_z.i = z;
|
||||
result.u = bitfieldInterleave(sign_x.u, sign_y.u, sign_z.u);
|
||||
|
||||
return result.i;
|
||||
}
|
||||
|
||||
GLM_FUNC_QUALIFIER uint32 bitfieldInterleave(uint8 x, uint8 y, uint8 z)
|
||||
{
|
||||
return detail::bitfieldInterleave<uint8, uint32>(x, y, z);
|
||||
}
|
||||
|
||||
GLM_FUNC_QUALIFIER int64 bitfieldInterleave(int16 x, int16 y, int16 z)
|
||||
{
|
||||
union sign16
|
||||
{
|
||||
int16 i;
|
||||
uint16 u;
|
||||
} sign_x, sign_y, sign_z;
|
||||
|
||||
union sign64
|
||||
{
|
||||
int64 i;
|
||||
uint64 u;
|
||||
} result;
|
||||
|
||||
sign_x.i = x;
|
||||
sign_y.i = y;
|
||||
sign_z.i = z;
|
||||
result.u = bitfieldInterleave(sign_x.u, sign_y.u, sign_z.u);
|
||||
|
||||
return result.i;
|
||||
}
|
||||
|
||||
GLM_FUNC_QUALIFIER uint64 bitfieldInterleave(uint16 x, uint16 y, uint16 z)
|
||||
{
|
||||
return detail::bitfieldInterleave<uint32, uint64>(x, y, z);
|
||||
}
|
||||
|
||||
GLM_FUNC_QUALIFIER int64 bitfieldInterleave(int32 x, int32 y, int32 z)
|
||||
{
|
||||
union sign16
|
||||
{
|
||||
int32 i;
|
||||
uint32 u;
|
||||
} sign_x, sign_y, sign_z;
|
||||
|
||||
union sign64
|
||||
{
|
||||
int64 i;
|
||||
uint64 u;
|
||||
} result;
|
||||
|
||||
sign_x.i = x;
|
||||
sign_y.i = y;
|
||||
sign_z.i = z;
|
||||
result.u = bitfieldInterleave(sign_x.u, sign_y.u, sign_z.u);
|
||||
|
||||
return result.i;
|
||||
}
|
||||
|
||||
GLM_FUNC_QUALIFIER uint64 bitfieldInterleave(uint32 x, uint32 y, uint32 z)
|
||||
{
|
||||
return detail::bitfieldInterleave<uint32, uint64>(x, y, z);
|
||||
}
|
||||
|
||||
GLM_FUNC_QUALIFIER int32 bitfieldInterleave(int8 x, int8 y, int8 z, int8 w)
|
||||
{
|
||||
union sign8
|
||||
{
|
||||
int8 i;
|
||||
uint8 u;
|
||||
} sign_x, sign_y, sign_z, sign_w;
|
||||
|
||||
union sign32
|
||||
{
|
||||
int32 i;
|
||||
uint32 u;
|
||||
} result;
|
||||
|
||||
sign_x.i = x;
|
||||
sign_y.i = y;
|
||||
sign_z.i = z;
|
||||
sign_w.i = w;
|
||||
result.u = bitfieldInterleave(sign_x.u, sign_y.u, sign_z.u, sign_w.u);
|
||||
|
||||
return result.i;
|
||||
}
|
||||
|
||||
GLM_FUNC_QUALIFIER uint32 bitfieldInterleave(uint8 x, uint8 y, uint8 z, uint8 w)
|
||||
{
|
||||
return detail::bitfieldInterleave<uint8, uint32>(x, y, z, w);
|
||||
}
|
||||
|
||||
GLM_FUNC_QUALIFIER int64 bitfieldInterleave(int16 x, int16 y, int16 z, int16 w)
|
||||
{
|
||||
union sign16
|
||||
{
|
||||
int16 i;
|
||||
uint16 u;
|
||||
} sign_x, sign_y, sign_z, sign_w;
|
||||
|
||||
union sign64
|
||||
{
|
||||
int64 i;
|
||||
uint64 u;
|
||||
} result;
|
||||
|
||||
sign_x.i = x;
|
||||
sign_y.i = y;
|
||||
sign_z.i = z;
|
||||
sign_w.i = w;
|
||||
result.u = bitfieldInterleave(sign_x.u, sign_y.u, sign_z.u, sign_w.u);
|
||||
|
||||
return result.i;
|
||||
}
|
||||
|
||||
GLM_FUNC_QUALIFIER uint64 bitfieldInterleave(uint16 x, uint16 y, uint16 z, uint16 w)
|
||||
{
|
||||
return detail::bitfieldInterleave<uint16, uint64>(x, y, z, w);
|
||||
}
|
||||
}//namespace glm
|
||||
@ -12,6 +12,10 @@
|
||||
/// 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
|
||||
@ -36,8 +40,7 @@
|
||||
/// <glm/gtc/constants.hpp> need to be included to use these features.
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef GLM_GTC_constants
|
||||
#define GLM_GTC_constants
|
||||
#pragma once
|
||||
|
||||
// Dependencies
|
||||
#include "../detail/setup.hpp"
|
||||
@ -52,7 +55,6 @@ namespace glm
|
||||
/// @{
|
||||
|
||||
/// Return the epsilon constant for floating point types.
|
||||
/// @todo Implement epsilon for half-precision floating point type.
|
||||
/// @see gtc_constants
|
||||
template <typename genType>
|
||||
GLM_FUNC_DECL genType epsilon();
|
||||
@ -72,6 +74,11 @@ namespace glm
|
||||
template <typename genType>
|
||||
GLM_FUNC_DECL genType pi();
|
||||
|
||||
/// Return pi * 2.
|
||||
/// @see gtc_constants
|
||||
template <typename genType>
|
||||
GLM_FUNC_DECL genType two_pi();
|
||||
|
||||
/// Return square root of pi.
|
||||
/// @see gtc_constants
|
||||
template <typename genType>
|
||||
@ -82,6 +89,11 @@ namespace glm
|
||||
template <typename genType>
|
||||
GLM_FUNC_DECL genType half_pi();
|
||||
|
||||
/// Return pi / 2 * 3.
|
||||
/// @see gtc_constants
|
||||
template <typename genType>
|
||||
GLM_FUNC_DECL genType three_over_two_pi();
|
||||
|
||||
/// Return pi / 4.
|
||||
/// @see gtc_constants
|
||||
template <typename genType>
|
||||
@ -92,11 +104,21 @@ namespace glm
|
||||
template <typename genType>
|
||||
GLM_FUNC_DECL genType one_over_pi();
|
||||
|
||||
/// Return 1 / (pi * 2).
|
||||
/// @see gtc_constants
|
||||
template <typename genType>
|
||||
GLM_FUNC_DECL genType one_over_two_pi();
|
||||
|
||||
/// Return 2 / pi.
|
||||
/// @see gtc_constants
|
||||
template <typename genType>
|
||||
GLM_FUNC_DECL genType two_over_pi();
|
||||
|
||||
/// Return 4 / pi.
|
||||
/// @see gtc_constants
|
||||
template <typename genType>
|
||||
GLM_FUNC_DECL genType four_over_pi();
|
||||
|
||||
/// Return 2 / sqrt(pi).
|
||||
/// @see gtc_constants
|
||||
template <typename genType>
|
||||
@ -181,5 +203,3 @@ namespace glm
|
||||
} //namespace glm
|
||||
|
||||
#include "constants.inl"
|
||||
|
||||
#endif//GLM_GTC_constants
|
||||
|
||||
@ -12,6 +12,10 @@
|
||||
/// 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
|
||||
@ -20,9 +24,9 @@
|
||||
/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
/// THE SOFTWARE.
|
||||
///
|
||||
/// @ref gtx_constants
|
||||
/// @file glm/gtx/constants.inl
|
||||
/// @date 2011-10-14 / 2012-01-25
|
||||
/// @ref gtc_constants
|
||||
/// @file glm/gtc/constants.inl
|
||||
/// @date 2011-10-14 / 2014-10-25
|
||||
/// @author Christophe Riccio
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@ -54,6 +58,12 @@ namespace glm
|
||||
return genType(3.14159265358979323846264338327950288);
|
||||
}
|
||||
|
||||
template <typename genType>
|
||||
GLM_FUNC_QUALIFIER genType two_pi()
|
||||
{
|
||||
return genType(6.28318530717958647692528676655900576);
|
||||
}
|
||||
|
||||
template <typename genType>
|
||||
GLM_FUNC_QUALIFIER genType root_pi()
|
||||
{
|
||||
@ -66,6 +76,12 @@ namespace glm
|
||||
return genType(1.57079632679489661923132169163975144);
|
||||
}
|
||||
|
||||
template <typename genType>
|
||||
GLM_FUNC_QUALIFIER genType three_over_two_pi()
|
||||
{
|
||||
return genType(4.71238898038468985769396507491925432);
|
||||
}
|
||||
|
||||
template <typename genType>
|
||||
GLM_FUNC_QUALIFIER genType quarter_pi()
|
||||
{
|
||||
@ -78,12 +94,24 @@ namespace glm
|
||||
return genType(0.318309886183790671537767526745028724);
|
||||
}
|
||||
|
||||
template <typename genType>
|
||||
GLM_FUNC_QUALIFIER genType one_over_two_pi()
|
||||
{
|
||||
return genType(0.159154943091895335768883763372514362);
|
||||
}
|
||||
|
||||
template <typename genType>
|
||||
GLM_FUNC_QUALIFIER genType two_over_pi()
|
||||
{
|
||||
return genType(0.636619772367581343075535053490057448);
|
||||
}
|
||||
|
||||
template <typename genType>
|
||||
GLM_FUNC_QUALIFIER genType four_over_pi()
|
||||
{
|
||||
return genType(1.273239544735162686151070106980114898);
|
||||
}
|
||||
|
||||
template <typename genType>
|
||||
GLM_FUNC_QUALIFIER genType two_over_root_pi()
|
||||
{
|
||||
|
||||
@ -12,6 +12,10 @@
|
||||
/// 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
|
||||
@ -37,8 +41,7 @@
|
||||
/// <glm/gtc/epsilon.hpp> need to be included to use these functionalities.
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef GLM_GTC_epsilon
|
||||
#define GLM_GTC_epsilon
|
||||
#pragma once
|
||||
|
||||
// Dependencies
|
||||
#include "../detail/setup.hpp"
|
||||
@ -97,5 +100,3 @@ namespace glm
|
||||
}//namespace glm
|
||||
|
||||
#include "epsilon.inl"
|
||||
|
||||
#endif//GLM_GTC_epsilon
|
||||
|
||||
@ -12,6 +12,10 @@
|
||||
/// 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
|
||||
@ -125,26 +129,26 @@ namespace glm
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER detail::tvec4<bool, P> epsilonEqual
|
||||
GLM_FUNC_QUALIFIER tvec4<bool, P> epsilonEqual
|
||||
(
|
||||
detail::tquat<T, P> const & x,
|
||||
detail::tquat<T, P> const & y,
|
||||
tquat<T, P> const & x,
|
||||
tquat<T, P> const & y,
|
||||
T const & epsilon
|
||||
)
|
||||
{
|
||||
detail::tvec4<T, P> v(x.x - y.x, x.y - y.y, x.z - y.z, x.w - y.w);
|
||||
return lessThan(abs(v), detail::tvec4<T, P>(epsilon));
|
||||
tvec4<T, P> v(x.x - y.x, x.y - y.y, x.z - y.z, x.w - y.w);
|
||||
return lessThan(abs(v), tvec4<T, P>(epsilon));
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER detail::tvec4<bool, P> epsilonNotEqual
|
||||
GLM_FUNC_QUALIFIER tvec4<bool, P> epsilonNotEqual
|
||||
(
|
||||
detail::tquat<T, P> const & x,
|
||||
detail::tquat<T, P> const & y,
|
||||
tquat<T, P> const & x,
|
||||
tquat<T, P> const & y,
|
||||
T const & epsilon
|
||||
)
|
||||
{
|
||||
detail::tvec4<T, P> v(x.x - y.x, x.y - y.y, x.z - y.z, x.w - y.w);
|
||||
return greaterThanEqual(abs(v), detail::tvec4<T, P>(epsilon));
|
||||
tvec4<T, P> v(x.x - y.x, x.y - y.y, x.z - y.z, x.w - y.w);
|
||||
return greaterThanEqual(abs(v), tvec4<T, P>(epsilon));
|
||||
}
|
||||
}//namespace glm
|
||||
|
||||
105
common/glm/glm/gtc/integer.hpp
Normal file
105
common/glm/glm/gtc/integer.hpp
Normal file
@ -0,0 +1,105 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
/// OpenGL Mathematics (glm.g-truc.net)
|
||||
///
|
||||
/// Copyright (c) 2005 - 2014 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 gtc_integer
|
||||
/// @file glm/gtc/integer.hpp
|
||||
/// @date 2014-11-17 / 2014-11-17
|
||||
/// @author Christophe Riccio
|
||||
///
|
||||
/// @see core (dependence)
|
||||
/// @see gtc_integer (dependence)
|
||||
///
|
||||
/// @defgroup gtc_integer GLM_GTC_integer
|
||||
/// @ingroup gtc
|
||||
///
|
||||
/// @brief Allow to perform bit operations on integer values
|
||||
///
|
||||
/// <glm/gtc/integer.hpp> need to be included to use these functionalities.
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
// Dependencies
|
||||
#include "../detail/setup.hpp"
|
||||
#include "../detail/precision.hpp"
|
||||
#include "../detail/func_common.hpp"
|
||||
#include "../detail/func_integer.hpp"
|
||||
#include "../detail/func_exponential.hpp"
|
||||
#include <limits>
|
||||
|
||||
#if(defined(GLM_MESSAGES) && !defined(GLM_EXT_INCLUDED))
|
||||
# pragma message("GLM: GLM_GTC_integer extension included")
|
||||
#endif
|
||||
|
||||
namespace glm
|
||||
{
|
||||
/// @addtogroup gtc_integer
|
||||
/// @{
|
||||
|
||||
/// Returns the log2 of x for integer values. Can be reliably using to compute mipmap count from the texture size.
|
||||
/// @see gtc_integer
|
||||
template <typename genIUType>
|
||||
GLM_FUNC_DECL genIUType log2(genIUType x);
|
||||
|
||||
/// Modulus. Returns x % y
|
||||
/// for each component in x using the floating point value y.
|
||||
///
|
||||
/// @tparam genIUType Integer-point scalar or vector types.
|
||||
///
|
||||
/// @see gtc_integer
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/mod.xml">GLSL mod man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
|
||||
template <typename genIUType>
|
||||
GLM_FUNC_DECL genIUType mod(genIUType x, genIUType y);
|
||||
|
||||
/// Modulus. Returns x % y
|
||||
/// for each component in x using the floating point value y.
|
||||
///
|
||||
/// @tparam T Integer scalar types.
|
||||
/// @tparam vecType vector types.
|
||||
///
|
||||
/// @see gtc_integer
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/mod.xml">GLSL mod man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<T, P> mod(vecType<T, P> const & x, T y);
|
||||
|
||||
/// Modulus. Returns x % y
|
||||
/// for each component in x using the floating point value y.
|
||||
///
|
||||
/// @tparam T Integer scalar types.
|
||||
/// @tparam vecType vector types.
|
||||
///
|
||||
/// @see gtc_integer
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/mod.xml">GLSL mod man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<T, P> mod(vecType<T, P> const & x, vecType<T, P> const & y);
|
||||
|
||||
/// @}
|
||||
} //namespace glm
|
||||
|
||||
#include "integer.inl"
|
||||
74
common/glm/glm/gtc/integer.inl
Normal file
74
common/glm/glm/gtc/integer.inl
Normal file
@ -0,0 +1,74 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
/// OpenGL Mathematics (glm.g-truc.net)
|
||||
///
|
||||
/// Copyright (c) 2005 - 2014 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 gtc_integer
|
||||
/// @file glm/gtc/integer.inl
|
||||
/// @date 2014-11-17 / 2014-11-17
|
||||
/// @author Christophe Riccio
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
namespace glm{
|
||||
namespace detail
|
||||
{
|
||||
template <typename T, precision P, template <class, precision> class vecType>
|
||||
struct compute_log2<T, P, vecType, false>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & vec)
|
||||
{
|
||||
//Equivalent to return findMSB(vec); but save one function call in ASM with VC
|
||||
//return findMSB(vec);
|
||||
return vecType<T, P>(detail::compute_findMSB_vec<T, P, vecType, sizeof(T) * 8>::call(vec));
|
||||
}
|
||||
};
|
||||
|
||||
# if GLM_HAS_BITSCAN_WINDOWS
|
||||
template <precision P>
|
||||
struct compute_log2<int, P, tvec4, false>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static tvec4<int, P> call(tvec4<int, P> const & vec)
|
||||
{
|
||||
tvec4<int, P> Result(glm::uninitialize);
|
||||
|
||||
_BitScanReverse(reinterpret_cast<unsigned long*>(&Result.x), vec.x);
|
||||
_BitScanReverse(reinterpret_cast<unsigned long*>(&Result.y), vec.y);
|
||||
_BitScanReverse(reinterpret_cast<unsigned long*>(&Result.z), vec.z);
|
||||
_BitScanReverse(reinterpret_cast<unsigned long*>(&Result.w), vec.w);
|
||||
|
||||
return Result;
|
||||
}
|
||||
};
|
||||
# endif//GLM_HAS_BITSCAN_WINDOWS
|
||||
|
||||
template <typename T, precision P, template <class, precision> class vecType, typename genType>
|
||||
struct compute_mod<T, P, vecType, genType, false>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & a, genType const & b)
|
||||
{
|
||||
return a % b;
|
||||
}
|
||||
};
|
||||
}//namespace detail
|
||||
}//namespace glm
|
||||
@ -12,6 +12,10 @@
|
||||
/// 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
|
||||
@ -34,8 +38,7 @@
|
||||
/// <glm/gtc/matrix_access.hpp> need to be included to use these functionalities.
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef GLM_GTC_matrix_access
|
||||
#define GLM_GTC_matrix_access
|
||||
#pragma once
|
||||
|
||||
// Dependency:
|
||||
#include "../detail/setup.hpp"
|
||||
@ -53,15 +56,15 @@ namespace glm
|
||||
/// @see gtc_matrix_access
|
||||
template <typename genType>
|
||||
GLM_FUNC_DECL typename genType::row_type row(
|
||||
genType const & m,
|
||||
length_t const & index);
|
||||
genType const & m,
|
||||
length_t index);
|
||||
|
||||
/// Set a specific row to a matrix.
|
||||
/// @see gtc_matrix_access
|
||||
template <typename genType>
|
||||
GLM_FUNC_DECL genType row(
|
||||
genType const & m,
|
||||
length_t const & index,
|
||||
length_t index,
|
||||
typename genType::row_type const & x);
|
||||
|
||||
/// Get a specific column of a matrix.
|
||||
@ -69,19 +72,17 @@ namespace glm
|
||||
template <typename genType>
|
||||
GLM_FUNC_DECL typename genType::col_type column(
|
||||
genType const & m,
|
||||
length_t const & index);
|
||||
length_t index);
|
||||
|
||||
/// Set a specific column to a matrix.
|
||||
/// @see gtc_matrix_access
|
||||
template <typename genType>
|
||||
GLM_FUNC_DECL genType column(
|
||||
genType const & m,
|
||||
length_t const & index,
|
||||
length_t index,
|
||||
typename genType::col_type const & x);
|
||||
|
||||
/// @}
|
||||
}//namespace glm
|
||||
|
||||
#include "matrix_access.inl"
|
||||
|
||||
#endif//GLM_GTC_matrix_access
|
||||
|
||||
@ -12,6 +12,10 @@
|
||||
/// 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
|
||||
@ -32,14 +36,14 @@ namespace glm
|
||||
GLM_FUNC_QUALIFIER genType row
|
||||
(
|
||||
genType const & m,
|
||||
length_t const & index,
|
||||
length_t index,
|
||||
typename genType::row_type const & x
|
||||
)
|
||||
{
|
||||
assert(index >= 0 && index < m[0].length());
|
||||
assert(index >= 0 && static_cast<detail::component_count_t>(index) < detail::component_count(m[0]));
|
||||
|
||||
genType Result = m;
|
||||
for(length_t i = 0; i < m.length(); ++i)
|
||||
for(detail::component_count_t i = 0; i < detail::component_count(m); ++i)
|
||||
Result[i][index] = x[i];
|
||||
return Result;
|
||||
}
|
||||
@ -48,13 +52,13 @@ namespace glm
|
||||
GLM_FUNC_QUALIFIER typename genType::row_type row
|
||||
(
|
||||
genType const & m,
|
||||
length_t const & index
|
||||
length_t index
|
||||
)
|
||||
{
|
||||
assert(index >= 0 && index < m[0].length());
|
||||
assert(index >= 0 && static_cast<detail::component_count_t>(index) < detail::component_count(m[0]));
|
||||
|
||||
typename genType::row_type Result;
|
||||
for(length_t i = 0; i < m.length(); ++i)
|
||||
for(detail::component_count_t i = 0; i < detail::component_count(m); ++i)
|
||||
Result[i] = m[i][index];
|
||||
return Result;
|
||||
}
|
||||
@ -63,11 +67,11 @@ namespace glm
|
||||
GLM_FUNC_QUALIFIER genType column
|
||||
(
|
||||
genType const & m,
|
||||
length_t const & index,
|
||||
length_t index,
|
||||
typename genType::col_type const & x
|
||||
)
|
||||
{
|
||||
assert(index >= 0 && index < m.length());
|
||||
assert(index >= 0 && static_cast<detail::component_count_t>(index) < detail::component_count(m));
|
||||
|
||||
genType Result = m;
|
||||
Result[index] = x;
|
||||
@ -78,10 +82,10 @@ namespace glm
|
||||
GLM_FUNC_QUALIFIER typename genType::col_type column
|
||||
(
|
||||
genType const & m,
|
||||
length_t const & index
|
||||
length_t index
|
||||
)
|
||||
{
|
||||
assert(index >= 0 && index < m.length());
|
||||
assert(index >= 0 && static_cast<detail::component_count_t>(index) < detail::component_count(m));
|
||||
|
||||
return m[index];
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user