From 6ec248b75a9ee38dc7c9bba80bdaed35a6817747 Mon Sep 17 00:00:00 2001 From: Dave Reid Date: Sat, 22 Dec 2012 14:21:17 +1000 Subject: [PATCH] Add static xpos, xneg, ypos, etc constants to tvec2. --- glm/core/type_vec2.hpp | 14 ++++++++++++++ glm/core/type_vec2.inl | 15 +++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/glm/core/type_vec2.hpp b/glm/core/type_vec2.hpp index 0cdcdc63..3efb090b 100644 --- a/glm/core/type_vec2.hpp +++ b/glm/core/type_vec2.hpp @@ -219,6 +219,20 @@ namespace detail GLM_FUNC_DECL tvec3 swizzle(comp X, comp Y, comp Z) const; GLM_FUNC_DECL tvec4 swizzle(comp X, comp Y, comp Z, comp W) const; GLM_FUNC_DECL tref2 swizzle(comp X, comp Y); + + + ////////////////////////////////////// + // Static constants + + static const tvec2 xpos; + static const tvec2 xneg; + static const tvec2 ypos; + static const tvec2 yneg; + + static const tvec2 right; + static const tvec2 left; + static const tvec2 up; + static const tvec2 down; }; template diff --git a/glm/core/type_vec2.inl b/glm/core/type_vec2.inl index ccf0f1fd..1a1f501c 100644 --- a/glm/core/type_vec2.inl +++ b/glm/core/type_vec2.inl @@ -1024,5 +1024,20 @@ namespace detail { return tvec2(this->x, this->y); } + + + ////////////////////////////////////// + // Static constants + + template const tvec2 tvec2::xpos = tvec2(T( 1), T( 0)); + template const tvec2 tvec2::xneg = tvec2(T(-1), T( 0)); + template const tvec2 tvec2::ypos = tvec2(T( 0), T( 1)); + template const tvec2 tvec2::yneg = tvec2(T( 0), T(-1)); + + template const tvec2 tvec2::right = tvec2(T( 1), T( 0)); + template const tvec2 tvec2::left = tvec2(T(-1), T( 0)); + template const tvec2 tvec2::up = tvec2(T( 0), T( 1)); + template const tvec2 tvec2::down = tvec2(T( 0), T(-1)); + }//namespace detail }//namespace glm