Commit 09621224 authored by Robert Menzel's avatar Robert Menzel

updated GLM, note that 0.9.5 has some incompatibilities...

updated GLM, note that 0.9.5 has some incompatibilities glm::translate(float,float,float) -> translate(vec3())
parent 944ba6ee
......@@ -44,6 +44,8 @@
// gcc >= 4.6:
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wtype-limits"
# pragma GCC diagnostic ignored "-Wunused-but-set-variable"
# pragma GCC diagnostic ignored "-Wstrict-aliasing"
# endif
// gcc:
# pragma GCC diagnostic ignored "-Wunused-parameter"
......@@ -51,8 +53,10 @@
//
/////////////////////////////////////////////////////////////////////////////////////
#define GLM_FORCE_RADIANS
#include <glm/glm.hpp>
#include <glm/gtx/transform.hpp>
#include <glm/ext.hpp>
......
set(NAME glm)
set(NAME glm_dummy)
file(GLOB ROOT_SOURCE *.cpp)
file(GLOB ROOT_INLINE *.inl)
file(GLOB ROOT_HEADER *.hpp)
file(GLOB ROOT_TEXT ../*.txt)
file(GLOB_RECURSE CORE_SOURCE ./core/*.cpp)
file(GLOB_RECURSE CORE_INLINE ./core/*.inl)
file(GLOB_RECURSE CORE_HEADER ./core/*.hpp)
file(GLOB_RECURSE CORE_SOURCE ./detail/*.cpp)
file(GLOB_RECURSE CORE_INLINE ./detail/*.inl)
file(GLOB_RECURSE CORE_HEADER ./detail/*.hpp)
file(GLOB_RECURSE GTC_SOURCE ./gtc/*.cpp)
file(GLOB_RECURSE GTC_INLINE ./gtc/*.inl)
......@@ -16,10 +17,7 @@ file(GLOB_RECURSE GTX_SOURCE ./gtx/*.cpp)
file(GLOB_RECURSE GTX_INLINE ./gtx/*.inl)
file(GLOB_RECURSE GTX_HEADER ./gtx/*.hpp)
file(GLOB_RECURSE VIRTREV_SOURCE ./virtrev/*.cpp)
file(GLOB_RECURSE VIRTREV_INLINE ./virtrev/*.inl)
file(GLOB_RECURSE VIRTREV_HEADER ./virtrev/*.hpp)
source_group("Text Files" FILES ${ROOT_TEXT})
source_group("Core Files" FILES ${CORE_SOURCE})
source_group("Core Files" FILES ${CORE_INLINE})
source_group("Core Files" FILES ${CORE_HEADER})
......@@ -29,15 +27,14 @@ source_group("GTC Files" FILES ${GTC_HEADER})
source_group("GTX Files" FILES ${GTX_SOURCE})
source_group("GTX Files" FILES ${GTX_INLINE})
source_group("GTX Files" FILES ${GTX_HEADER})
source_group("VIRTREV Files" FILES ${VIRTREV_SOURCE})
source_group("VIRTREV Files" FILES ${VIRTREV_INLINE})
source_group("VIRTREV Files" FILES ${VIRTREV_HEADER})
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/..)
add_executable(${NAME}
${ROOT_SOURCE} ${ROOT_INLINE} ${ROOT_HEADER}
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}
${VIRTREV_SOURCE} ${VIRTREV_INLINE} ${VIRTREV_HEADER})
${GTC_SOURCE} ${GTC_INLINE} ${GTC_HEADER}
${GTX_SOURCE} ${GTX_INLINE} ${GTX_HEADER})
#add_library(glm STATIC glm.cpp)
#add_library(glm_shared SHARED glm.cpp)
///////////////////////////////////////////////////////////////////////////////////
/// 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.
///
/// 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/common.hpp
/// @date 2013-12-24 / 2013-12-24
/// @author Christophe Riccio
///////////////////////////////////////////////////////////////////////////////////
#ifndef GLM_COMMON_INCLUDED
#define GLM_COMMON_INCLUDED
#include "detail/func_common.hpp"
#endif//GLM_COMMON_INCLUDED
This diff is collapsed.
This diff is collapsed.
///////////////////////////////////////////////////////////////////////////////////
/// OpenGL Mathematics (glm.g-truc.net)
///
/// Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net)
/// Permission is hereby granted, free of charge, to any person obtaining a copy
/// of this software and associated documentation files (the "Software"), to deal
/// in the Software without restriction, including without limitation the rights
/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
/// copies of the Software, and to permit persons to whom the Software is
/// furnished to do so, subject to the following conditions:
///
/// The above copyright notice and this permission notice shall be included in
/// all copies or substantial portions of the Software.
///
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
/// THE SOFTWARE.
///
/// @ref core
/// @file glm/core/_vectorize.hpp
/// @date 2011-10-14 / 2011-10-14
/// @author Christophe Riccio
///////////////////////////////////////////////////////////////////////////////////
#define VECTORIZE2_VEC(func) \
template <typename T> \
GLM_FUNC_QUALIFIER detail::tvec2<T> func( \
detail::tvec2<T> const & v) \
{ \
return detail::tvec2<T>( \
func(v.x), \
func(v.y)); \
}
#define VECTORIZE3_VEC(func) \
template <typename T> \
GLM_FUNC_QUALIFIER detail::tvec3<T> func( \
detail::tvec3<T> const & v) \
{ \
return detail::tvec3<T>( \
func(v.x), \
func(v.y), \
func(v.z)); \
}
#define VECTORIZE4_VEC(func) \
template <typename T> \
GLM_FUNC_QUALIFIER detail::tvec4<T> func( \
detail::tvec4<T> const & v) \
{ \
return detail::tvec4<T>( \
func(v.x), \
func(v.y), \
func(v.z), \
func(v.w)); \
}
#define VECTORIZE_VEC(func) \
VECTORIZE2_VEC(func) \
VECTORIZE3_VEC(func) \
VECTORIZE4_VEC(func)
#define VECTORIZE2_VEC_SCA(func) \
template <typename T> \
GLM_FUNC_QUALIFIER detail::tvec2<T> func \
( \
detail::tvec2<T> const & x, \
typename detail::tvec2<T>::value_type const & y \
) \
{ \
return detail::tvec2<T>( \
func(x.x, y), \
func(x.y, y)); \
}
#define VECTORIZE3_VEC_SCA(func) \
template <typename T> \
GLM_FUNC_QUALIFIER detail::tvec3<T> func \
( \
detail::tvec3<T> const & x, \
typename detail::tvec3<T>::value_type const & y \
) \
{ \
return detail::tvec3<T>( \
func(x.x, y), \
func(x.y, y), \
func(x.z, y)); \
}
#define VECTORIZE4_VEC_SCA(func) \
template <typename T> \
GLM_FUNC_QUALIFIER detail::tvec4<T> func \
( \
detail::tvec4<T> const & x, \
typename detail::tvec4<T>::value_type const & y \
) \
{ \
return detail::tvec4<T>( \
func(x.x, y), \
func(x.y, y), \
func(x.z, y), \
func(x.w, y)); \
}
#define VECTORIZE_VEC_SCA(func) \
VECTORIZE2_VEC_SCA(func) \
VECTORIZE3_VEC_SCA(func) \
VECTORIZE4_VEC_SCA(func)
#define VECTORIZE2_VEC_VEC(func) \
template <typename T> \
GLM_FUNC_QUALIFIER detail::tvec2<T> func \
( \
detail::tvec2<T> const & x, \
detail::tvec2<T> const & y \
) \
{ \
return detail::tvec2<T>( \
func(x.x, y.x), \
func(x.y, y.y)); \
}
#define VECTORIZE3_VEC_VEC(func) \
template <typename T> \
GLM_FUNC_QUALIFIER detail::tvec3<T> func \
( \
detail::tvec3<T> const & x, \
detail::tvec3<T> const & y \
) \
{ \
return detail::tvec3<T>( \
func(x.x, y.x), \
func(x.y, y.y), \
func(x.z, y.z)); \
}
#define VECTORIZE4_VEC_VEC(func) \
template <typename T> \
GLM_FUNC_QUALIFIER detail::tvec4<T> func \
( \
detail::tvec4<T> const & x, \
detail::tvec4<T> const & y \
) \
{ \
return detail::tvec4<T>( \
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)
This diff is collapsed.
This diff is collapsed.
///////////////////////////////////////////////////////////////////////////////////
/// OpenGL Mathematics (glm.g-truc.net)
///
/// Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net)
/// Permission is hereby granted, free of charge, to any person obtaining a copy
/// of this software and associated documentation files (the "Software"), to deal
/// in the Software without restriction, including without limitation the rights
/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
/// copies of the Software, and to permit persons to whom the Software is
/// furnished to do so, subject to the following conditions:
///
/// The above copyright notice and this permission notice shall be included in
/// all copies or substantial portions of the Software.
///
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
/// THE SOFTWARE.
///
/// @ref core
/// @file glm/core/func_packing.inl
/// @date 2010-03-17 / 2011-06-15
/// @author Christophe Riccio
///////////////////////////////////////////////////////////////////////////////////
namespace glm
{
GLM_FUNC_QUALIFIER detail::uint32 packUnorm2x16(detail::tvec2<detail::float32> const & v)
{
detail::uint16 A(detail::uint16(round(clamp(v.x, 0.0f, 1.0f) * 65535.0f)));
detail::uint16 B(detail::uint16(round(clamp(v.y, 0.0f, 1.0f) * 65535.0f)));
return detail::uint32((B << 16) | A);
}
GLM_FUNC_QUALIFIER detail::tvec2<detail::float32> unpackUnorm2x16(detail::uint32 const & p)
{
detail::uint32 Mask16((1 << 16) - 1);
detail::uint32 A((p >> 0) & Mask16);
detail::uint32 B((p >> 16) & Mask16);
return detail::tvec2<detail::float32>(
A * 1.0f / 65535.0f,
B * 1.0f / 65535.0f);
}
GLM_FUNC_QUALIFIER detail::uint32 packSnorm2x16(detail::tvec2<detail::float32> const & v)
{
union iu
{
detail::int16 i;
detail::uint16 u;
} A, B;
detail::tvec2<detail::float32> Unpack = clamp(v ,-1.0f, 1.0f) * 32767.0f;
A.i = detail::int16(round(Unpack.x));
B.i = detail::int16(round(Unpack.y));
detail::uint32 Pack = (detail::uint32(B.u) << 16) | (detail::uint32(A.u) << 0);
return Pack;
}
GLM_FUNC_QUALIFIER detail::tvec2<detail::float32> unpackSnorm2x16(detail::uint32 const & p)
{
union iu
{
detail::int16 i;
detail::uint16 u;
} A, B;
detail::uint32 Mask16((1 << 16) - 1);
A.u = detail::uint16((p >> 0) & Mask16);
B.u = detail::uint16((p >> 16) & Mask16);
detail::tvec2<detail::float32> Pack(A.i, B.i);
return clamp(Pack * 1.0f / 32767.0f, -1.0f, 1.0f);
}
GLM_FUNC_QUALIFIER detail::uint32 packUnorm4x8(detail::tvec4<detail::float32> const & v)
{
detail::uint8 A((detail::uint8)round(clamp(v.x, 0.0f, 1.0f) * 255.0f));
detail::uint8 B((detail::uint8)round(clamp(v.y, 0.0f, 1.0f) * 255.0f));
detail::uint8 C((detail::uint8)round(clamp(v.z, 0.0f, 1.0f) * 255.0f));
detail::uint8 D((detail::uint8)round(clamp(v.w, 0.0f, 1.0f) * 255.0f));
return detail::uint32((D << 24) | (C << 16) | (B << 8) | A);
}
GLM_FUNC_QUALIFIER detail::tvec4<detail::float32> unpackUnorm4x8(detail::uint32 const & p)
{
detail::uint32 Mask8((1 << 8) - 1);
detail::uint32 A((p >> 0) & Mask8);
detail::uint32 B((p >> 8) & Mask8);
detail::uint32 C((p >> 16) & Mask8);
detail::uint32 D((p >> 24) & Mask8);
return detail::tvec4<detail::float32>(
A * 1.0f / 255.0f,
B * 1.0f / 255.0f,
C * 1.0f / 255.0f,
D * 1.0f / 255.0f);
}
GLM_FUNC_QUALIFIER detail::uint32 packSnorm4x8(detail::tvec4<detail::float32> const & v)
{
union iu
{
detail::int8 i;
detail::uint8 u;
} A, B, C, D;
detail::tvec4<detail::float32> Unpack = clamp(v ,-1.0f, 1.0f) * 127.0f;
A.i = detail::int8(round(Unpack.x));
B.i = detail::int8(round(Unpack.y));
C.i = detail::int8(round(Unpack.z));
D.i = detail::int8(round(Unpack.w));
detail::uint32 Pack = (detail::uint32(D.u) << 24) | (detail::uint32(C.u) << 16) | (detail::uint32(B.u) << 8) | (detail::uint32(A.u) << 0);
return Pack;
}
GLM_FUNC_QUALIFIER detail::tvec4<detail::float32> unpackSnorm4x8(detail::uint32 const & p)
{
union iu
{
detail::int8 i;
detail::uint8 u;
} A, B, C, D;
detail::uint32 Mask8((1 << 8) - 1);
A.u = detail::uint8((p >> 0) & Mask8);
B.u = detail::uint8((p >> 8) & Mask8);
C.u = detail::uint8((p >> 16) & Mask8);
D.u = detail::uint8((p >> 24) & Mask8);
detail::tvec4<detail::float32> Pack(A.i, B.i, C.i, D.i);
return clamp(Pack * 1.0f / 127.0f, -1.0f, 1.0f);
}
GLM_FUNC_QUALIFIER double packDouble2x32(detail::tvec2<detail::uint32> const & v)
{
struct uint32_pair
{
detail::uint32 x;
detail::uint32 y;
};
union helper
{
uint32_pair input;
double output;
} Helper;
Helper.input.x = v.x;
Helper.input.y = v.y;
return Helper.output;
//return *(double*)&v;
}
GLM_FUNC_QUALIFIER detail::tvec2<uint> unpackDouble2x32(double const & v)
{
struct uint32_pair
{
detail::uint32 x;
detail::uint32 y;
};
union helper
{
double input;
uint32_pair output;
} Helper;
Helper.input = v;
return detail::tvec2<uint>(Helper.output.x, Helper.output.y);
}
GLM_FUNC_QUALIFIER uint packHalf2x16(detail::tvec2<float> const & v)
{
union helper
{
uint other;
struct
{
detail::hdata a, b;
} orig;
} Pack;
Pack.orig.a = detail::toFloat16(v.x);
Pack.orig.b = detail::toFloat16(v.y);
return Pack.other;
}
GLM_FUNC_QUALIFIER vec2 unpackHalf2x16(uint const & v)
{
union helper
{
uint other;
struct
{
detail::hdata a, b;
} orig;
} Unpack;
Unpack.other = v;
return vec2(detail::toFloat32(Unpack.orig.a), detail::toFloat32(Unpack.orig.b));
}
}//namespace glm
This diff is collapsed.
///////////////////////////////////////////////////////////////////////////////////
/// OpenGL Mathematics (glm.g-truc.net)
///
/// Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net)
/// Permission is hereby granted, free of charge, to any person obtaining a copy
/// of this software and associated documentation files (the "Software"), to deal
/// in the Software without restriction, including without limitation the rights
/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
/// copies of the Software, and to permit persons to whom the Software is
/// furnished to do so, subject to the following conditions:
///
/// The above copyright notice and this permission notice shall be included in
/// all copies or substantial portions of the Software.
///
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
/// THE SOFTWARE.
///
/// @ref core
/// @file glm/core/type_mat2x3.hpp
/// @date 2006-10-01 / 2011-06-15
/// @author Christophe Riccio
///////////////////////////////////////////////////////////////////////////////////
#ifndef glm_core_type_mat2x3
#define glm_core_type_mat2x3
#include "type_mat.hpp"
namespace glm{
namespace detail
{
template <typename T> struct tvec1;
template <typename T> struct tvec2;
template <typename T> struct tvec3;
template <typename T> struct tvec4;
template <typename T> struct tmat2x2;
template <typename T> struct tmat2x3;
template <typename T> struct tmat2x4;
template <typename T> struct tmat3x2;
template <typename T> struct tmat3x3;
template <typename T> struct tmat3x4;
template <typename T> struct tmat4x2;
template <typename T> struct tmat4x3;
template <typename T> struct tmat4x4;
template <typename T>
struct tmat2x3
{
enum ctor{null};
typedef T value_type;
typedef std::size_t size_type;
typedef tvec3<T> col_type;
typedef tvec2<T> row_type;
typedef tmat2x3<T> type;
typedef tmat3x2<T> transpose_type;
static GLM_FUNC_DECL size_type col_size();
static GLM_FUNC_DECL size_type row_size();
GLM_FUNC_DECL GLM_CONSTEXPR size_type length() const;
private:
// Data
col_type value[2];
public:
// Constructors
GLM_FUNC_DECL tmat2x3();
GLM_FUNC_DECL tmat2x3(tmat2x3 const & m);
GLM_FUNC_DECL explicit tmat2x3(
ctor);
GLM_FUNC_DECL explicit tmat2x3(
value_type const & s);
GLM_FUNC_DECL explicit tmat2x3(
value_type const & x0, value_type const & y0, value_type const & z0,
value_type const & x1, value_type const & y1, value_type const & z1);
GLM_FUNC_DECL explicit tmat2x3(
col_type const & v0,
col_type const & v1);
//////////////////////////////////////
// Conversions
template <typename U>
GLM_FUNC_DECL explicit tmat2x3(
U const & x);
template <typename X1, typename Y1, typename Z1, typename X2, typename Y2, typename Z2>
GLM_FUNC_DECL explicit tmat2x3(
X1 const & x1, Y1 const & y1, Z1 const & z1,
X2 const & x2, Y2 const & y2, Z2 const & z2);
template <typename U, typename V>
GLM_FUNC_DECL explicit tmat2x3(
tvec3<U> const & v1,
tvec3<V> const & v2);
//////////////////////////////////////
// Matrix conversion
template <typename U>
GLM_FUNC_DECL explicit tmat2x3(tmat2x3<U> const & m);
GLM_FUNC_DECL explicit tmat2x3(tmat2x2<T> const & x);
GLM_FUNC_DECL explicit tmat2x3(tmat3x3<T> const & x);
GLM_FUNC_DECL explicit tmat2x3(tmat4x4<T> const & x);
GLM_FUNC_DECL explicit tmat2x3(tmat2x4<T> const & x);
GLM_FUNC_DECL explicit tmat2x3(tmat3x2<T> const & x);
GLM_FUNC_DECL explicit tmat2x3(tmat3x4<T> const & x);
GLM_FUNC_DECL explicit tmat2x3(tmat4x2<T> const & x);
GLM_FUNC_DECL explicit tmat2x3(tmat4x3<T> 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 tmat2x3<T> & operator= (tmat2x3<T> const & m);
template <typename U>
GLM_FUNC_DECL tmat2x3<T> & operator= (tmat2x3<U> const & m);
template <typename U>
GLM_FUNC_DECL tmat2x3<T> & operator+= (U s);
template <typename U>
GLM_FUNC_DECL tmat2x3<T> & operator+= (tmat2x3<U> const & m);