From 39fe5fbe34f4a332bc4946b661fa05f4a87f6b04 Mon Sep 17 00:00:00 2001 From: Andrew Bell Date: Mon, 26 Jan 2015 12:18:02 -0500 Subject: [PATCH] Changes necessary for GLM 0.9.6.1 upgrade; primarily moving things from glm::detail to glm:: --- include/cinder/Area.h | 2 +- include/cinder/Cinder.h | 1 - include/cinder/Frustum.h | 2 +- include/cinder/Matrix.h | 28 ++++++++--------- include/cinder/MatrixAffine2.h | 4 +-- include/cinder/Plane.h | 2 +- include/cinder/Rect.h | 4 +-- include/cinder/Vector.h | 10 +++--- src/cinder/Matrix.cpp | 56 +++++++++++++++++----------------- src/cinder/PolyLine.cpp | 4 +-- 10 files changed, 56 insertions(+), 57 deletions(-) diff --git a/include/cinder/Area.h b/include/cinder/Area.h index 37ab9ff2c7..71207731e9 100644 --- a/include/cinder/Area.h +++ b/include/cinder/Area.h @@ -77,7 +77,7 @@ class Area { bool contains( const ivec2 &offset ) const; template - bool contains( const glm::detail::tvec2 &offset ) const { return contains( ivec2( (int32_t)math::ceil( offset. x ), (int32_t)math::ceil( offset.y ) ) ); } + bool contains( const glm::tvec2 &offset ) const { return contains( ivec2( (int32_t)math::ceil( offset. x ), (int32_t)math::ceil( offset.y ) ) ); } bool intersects( const Area &area ) const; //! Expands the Area to include \a point in its interior diff --git a/include/cinder/Cinder.h b/include/cinder/Cinder.h index 96a4ddaac9..8e23242aeb 100644 --- a/include/cinder/Cinder.h +++ b/include/cinder/Cinder.h @@ -28,7 +28,6 @@ #endif #endif -#define GLM_FORCE_RADIANS #include "glm/fwd.hpp" #include diff --git a/include/cinder/Frustum.h b/include/cinder/Frustum.h index ea11366e34..9a93a49f66 100644 --- a/include/cinder/Frustum.h +++ b/include/cinder/Frustum.h @@ -44,7 +44,7 @@ class Frustum { public: enum { NEAR, FAR, LEFT, RIGHT, TOP, BOTTOM }; - typedef glm::detail::tvec3 Vec3T; + typedef glm::tvec3 Vec3T; public: Frustum() {} diff --git a/include/cinder/Matrix.h b/include/cinder/Matrix.h index f52673d7b4..37daf435c2 100644 --- a/include/cinder/Matrix.h +++ b/include/cinder/Matrix.h @@ -80,26 +80,26 @@ class ParallelTransport { }; template -glm::detail::tmat4x4 firstFrame( - const glm::detail::tvec3 &firstPoint, - const glm::detail::tvec3 &secondPoint, - const glm::detail::tvec3 &thirdPoint +glm::tmat4x4 firstFrame( + const glm::tvec3 &firstPoint, + const glm::tvec3 &secondPoint, + const glm::tvec3 &thirdPoint ); template -glm::detail::tmat4x4 nextFrame( - const glm::detail::tmat4x4 &prevMatrix, - const glm::detail::tvec3 &prevPoint, - const glm::detail::tvec3 &curPoint, - glm::detail::tvec3 prevTangent, - glm::detail::tvec3 curTangent +glm::tmat4x4 nextFrame( + const glm::tmat4x4 &prevMatrix, + const glm::tvec3 &prevPoint, + const glm::tvec3 &curPoint, + glm::tvec3 prevTangent, + glm::tvec3 curTangent ); template -glm::detail::tmat4x4 lastFrame( - const glm::detail::tmat4x4 &prevMatrix, - const glm::detail::tvec3 &prevPoint, - const glm::detail::tvec3 &lastPoint +glm::tmat4x4 lastFrame( + const glm::tmat4x4 &prevMatrix, + const glm::tvec3 &prevPoint, + const glm::tvec3 &lastPoint ); } // namespace cinder diff --git a/include/cinder/MatrixAffine2.h b/include/cinder/MatrixAffine2.h index 8ca8d282b8..9edf4885a1 100644 --- a/include/cinder/MatrixAffine2.h +++ b/include/cinder/MatrixAffine2.h @@ -40,8 +40,8 @@ class MatrixAffine2 public: typedef T TYPE; typedef T value_type; - typedef glm::detail::tvec2 Vec2T; - typedef glm::detail::tvec3 Vec3T; + typedef glm::tvec2 Vec2T; + typedef glm::tvec3 Vec3T; static const size_t MEM_LEN = sizeof(T)*6; diff --git a/include/cinder/Plane.h b/include/cinder/Plane.h index 1212d91670..a63d586740 100644 --- a/include/cinder/Plane.h +++ b/include/cinder/Plane.h @@ -35,7 +35,7 @@ namespace cinder { template class Plane { public: - typedef glm::detail::tvec3 Vec3T; + typedef glm::tvec3 Vec3T; Plane() {} Plane( const Vec3T &v1, const Vec3T &v2, const Vec3T &v3 ); diff --git a/include/cinder/Rect.h b/include/cinder/Rect.h index 8008cdfbd6..6ab71081a8 100644 --- a/include/cinder/Rect.h +++ b/include/cinder/Rect.h @@ -34,7 +34,7 @@ template class MatrixAffine2; template class RectT { public: - typedef glm::detail::tvec2 Vec2T; + typedef glm::tvec2 Vec2T; RectT() {} //! Initializes the rectangle to be the bounding box of \a points @@ -75,7 +75,7 @@ class RectT { //! Is a point \a pt inside the rectangle template - bool contains( const glm::detail::tvec2 &pt ) const { return ( pt.x >= x1 ) && ( pt.x <= x2 ) && ( pt.y >= y1 ) && ( pt.y <= y2 ); } + bool contains( const glm::tvec2 &pt ) const { return ( pt.x >= x1 ) && ( pt.x <= x2 ) && ( pt.y >= y1 ) && ( pt.y <= y2 ); } bool contains( const Vec2T &pt ) const { return ( pt.x >= x1 ) && ( pt.x <= x2 ) && ( pt.y >= y1 ) && ( pt.y <= y2 ); } //! Returns whether \a rect intersects with this bool intersects( const RectT &rect ) const; diff --git a/include/cinder/Vector.h b/include/cinder/Vector.h index 1c968c0129..d91ea19d82 100644 --- a/include/cinder/Vector.h +++ b/include/cinder/Vector.h @@ -57,20 +57,20 @@ using glm::dvec4; //! Returns a vector which is orthogonal to \a vec template -glm::detail::tvec3 orthogonal( const glm::detail::tvec3 &vec ) +glm::tvec3 orthogonal( const glm::tvec3 &vec ) { if( math::abs( vec.y ) < (T)0.99 ) // abs(dot(u, Y)), somewhat arbitrary epsilon - return glm::detail::tvec3( -vec.z, 0, vec.x ); // cross( this, Y ) + return glm::tvec3( -vec.z, 0, vec.x ); // cross( this, Y ) else - return glm::detail::tvec3( 0, vec.z, -vec.y ); // cross( this, X ) + return glm::tvec3( 0, vec.z, -vec.y ); // cross( this, X ) } template -glm::detail::tvec3 slerp( const glm::detail::tvec3 &a, const glm::detail::tvec3 &b, T t ) +glm::tvec3 slerp( const glm::tvec3 &a, const glm::tvec3 &b, T t ) { T cosAlpha, alpha, sinAlpha; T t1, t2; - glm::detail::tvec3 result; + glm::tvec3 result; // get cosine of angle between vectors (-1 -> 1) cosAlpha = glm::dot( a, b ); diff --git a/src/cinder/Matrix.cpp b/src/cinder/Matrix.cpp index 8710d678c9..93ec6f4eb8 100644 --- a/src/cinder/Matrix.cpp +++ b/src/cinder/Matrix.cpp @@ -36,30 +36,30 @@ namespace cinder { // vectors and are co-linears, an arbitrary twist value will // be chosen. template -glm::detail::tmat4x4 firstFrame( - const glm::detail::tvec3 &firstPoint, - const glm::detail::tvec3 &secondPoint, - const glm::detail::tvec3 &thirdPoint +glm::tmat4x4 firstFrame( + const glm::tvec3 &firstPoint, + const glm::tvec3 &secondPoint, + const glm::tvec3 &thirdPoint ) { - glm::detail::tvec3 t = normalize( secondPoint - firstPoint ); + glm::tvec3 t = normalize( secondPoint - firstPoint ); - glm::detail::tvec3 n = normalize( cross( t, thirdPoint - firstPoint ) ); + glm::tvec3 n = normalize( cross( t, thirdPoint - firstPoint ) ); if( length( n ) == 0.0f ) { int i = fabs( t[0] ) < fabs( t[1] ) ? 0 : 1; if( fabs( t[2] ) < fabs( t[i] ) ) i = 2; - glm::detail::tvec3 v( (T)0.0, (T)0.0, (T)0.0 ); v[i] = (T)1.0; + glm::tvec3 v( (T)0.0, (T)0.0, (T)0.0 ); v[i] = (T)1.0; n = normalize( cross( t, v ) ); } - glm::detail::tvec3 b = cross( t, n ); + glm::tvec3 b = cross( t, n ); - glm::detail::tmat4x4 M; - M[0] = glm::detail::tvec4( b, 0 ); - M[1] = glm::detail::tvec4( n, 0 ); - M[2] = glm::detail::tvec4( t, 0 ); - M[3] = glm::detail::tvec4( firstPoint, 1 ); + glm::tmat4x4 M; + M[0] = glm::tvec4( b, 0 ); + M[1] = glm::tvec4( n, 0 ); + M[2] = glm::tvec4( t, 0 ); + M[3] = glm::tvec4( firstPoint, 1 ); return M; @@ -71,15 +71,15 @@ glm::detail::tmat4x4 firstFrame( // frame defined by the previously computed transformation matrix and the // new point and tangent vector along the curve. template -glm::detail::tmat4x4 nextFrame( - const glm::detail::tmat4x4 &prevMatrix, - const glm::detail::tvec3 &prevPoint, - const glm::detail::tvec3 &curPoint, - glm::detail::tvec3 prevTangent, - glm::detail::tvec3 curTangent +glm::tmat4x4 nextFrame( + const glm::tmat4x4 &prevMatrix, + const glm::tvec3 &prevPoint, + const glm::tvec3 &curPoint, + glm::tvec3 prevTangent, + glm::tvec3 curTangent ) { - glm::detail::tvec3 axis( 0 ); // Rotation axis. + glm::tvec3 axis( 0 ); // Rotation axis. T r = 0; // Rotation angle. if( ( length( prevTangent ) != 0 ) && ( length( curTangent ) != 0 ) ) { @@ -95,14 +95,14 @@ glm::detail::tmat4x4 nextFrame( } if( ( length( axis ) != 0 ) && ( r != 0 ) ) { - glm::detail::tmat4x4 R = glm::rotate( r, axis ); - glm::detail::tmat4x4 Tj = glm::translate( curPoint ); - glm::detail::tmat4x4 Ti = glm::translate( -prevPoint ); + glm::tmat4x4 R = glm::rotate( r, axis ); + glm::tmat4x4 Tj = glm::translate( curPoint ); + glm::tmat4x4 Ti = glm::translate( -prevPoint ); return Tj * R * Ti * prevMatrix; } else { - glm::detail::tmat4x4 Tr = glm::translate( curPoint - prevPoint ); + glm::tmat4x4 Tr = glm::translate( curPoint - prevPoint ); return Tr * prevMatrix; } @@ -114,10 +114,10 @@ glm::detail::tmat4x4 nextFrame( // frame defined by the previously computed transformation matrix and the // last point along the curve. template -glm::detail::tmat4x4 lastFrame( - const glm::detail::tmat4x4 &prevMatrix, - const glm::detail::tvec3 &prevPoint, - const glm::detail::tvec3 &lastPoint +glm::tmat4x4 lastFrame( + const glm::tmat4x4 &prevMatrix, + const glm::tvec3 &prevPoint, + const glm::tvec3 &lastPoint ) { return glm::translate( lastPoint - prevPoint ) * prevMatrix; diff --git a/src/cinder/PolyLine.cpp b/src/cinder/PolyLine.cpp index ae224e8f05..163ba8f3e7 100644 --- a/src/cinder/PolyLine.cpp +++ b/src/cinder/PolyLine.cpp @@ -71,14 +71,14 @@ void PolyLineT::offset( const T &offsetBy ) } template -T linearYatX( const glm::detail::tvec2 p[2], T x ) +T linearYatX( const glm::tvec2 p[2], T x ) { if( p[0].x == p[1].x ) return p[0].y; return p[0].y + (p[1].y - p[0].y) * (x - p[0].x) / (p[1].x - p[0].x); } template -size_t linearCrossings( const glm::detail::tvec2 p[2], const vec2 &pt ) +size_t linearCrossings( const glm::tvec2 p[2], const vec2 &pt ) { if( (p[0].x < pt.x && pt.x <= p[1].x ) || (p[1].x < pt.x && pt.x <= p[0].x )) {