From 22a7f6d1f1c54979d1b4f9ab9794c49d3198eb3d Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Fri, 2 Jul 2010 16:19:26 +0100 Subject: [PATCH 1/4] Fixed swizzle extension --- glm/gtc/swizzle.hpp | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/glm/gtc/swizzle.hpp b/glm/gtc/swizzle.hpp index eb354080..e71210eb 100644 --- a/glm/gtc/swizzle.hpp +++ b/glm/gtc/swizzle.hpp @@ -11,7 +11,7 @@ /////////////////////////////////////////////////////////////////////////////////////////////////// #ifndef glm_gtc_swizzle -#define glm_gtc_closest_point +#define glm_gtc_swizzle // Dependency: #include "../glm.hpp" @@ -26,7 +26,25 @@ namespace glm //! GLM_GTC_swizzle extension namespace swizzle{ + template + T swizzle( + detail::tvec4 const & v, + comp x); + template + detail::tvec2 swizzle( + detail::tvec4 const & v, + comp x, comp y); + + template + detail::tvec3 swizzle( + detail::tvec4 const & v, + comp x, comp y, comp z); + + template + inline detail::tref4 swizzle( + detail::tvec4 const & v, + comp x, comp y, comp z, comp w); }//namespace swizzle }//namespace gtc From ea61e975e4208cbb85344ed1d257a8af70a7e183 Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Tue, 6 Jul 2010 14:02:25 +0100 Subject: [PATCH 2/4] Fixed ticket #24 --- glm/core/type_mat2x2.inl | 4 ++-- glm/core/type_mat2x3.inl | 4 ++-- glm/core/type_mat2x4.inl | 4 ++-- glm/core/type_mat3x2.inl | 4 ++-- glm/core/type_mat3x3.inl | 4 ++-- glm/core/type_mat3x4.inl | 4 ++-- glm/core/type_mat4x2.inl | 4 ++-- glm/core/type_mat4x3.inl | 4 ++-- glm/core/type_mat4x4.inl | 4 ++-- glm/core/type_vec1.inl | 4 ++-- glm/core/type_vec2.inl | 4 ++-- glm/core/type_vec3.inl | 4 ++-- glm/core/type_vec4.inl | 4 ++-- 13 files changed, 26 insertions(+), 26 deletions(-) diff --git a/glm/core/type_mat2x2.inl b/glm/core/type_mat2x2.inl index f2d9c2b5..1228478f 100644 --- a/glm/core/type_mat2x2.inl +++ b/glm/core/type_mat2x2.inl @@ -32,7 +32,7 @@ namespace detail size_type i ) { - assert(i >= size_type(0) && i < col_size()); + assert(i < col_size()); return this->value[i]; } @@ -43,7 +43,7 @@ namespace detail size_type i ) const { - assert(i >= size_type(0) && i < col_size()); + assert(i < col_size()); return this->value[i]; } diff --git a/glm/core/type_mat2x3.inl b/glm/core/type_mat2x3.inl index 16cd1eaf..94f43905 100644 --- a/glm/core/type_mat2x3.inl +++ b/glm/core/type_mat2x3.inl @@ -32,7 +32,7 @@ namespace detail size_type i ) { - assert(i >= size_type(0) && i < col_size()); + assert(i < col_size()); return this->value[i]; } @@ -43,7 +43,7 @@ namespace detail size_type i ) const { - assert(i >= size_type(0) && i < col_size()); + assert(i < col_size()); return this->value[i]; } diff --git a/glm/core/type_mat2x4.inl b/glm/core/type_mat2x4.inl index 2ae0b06f..9da29a7f 100644 --- a/glm/core/type_mat2x4.inl +++ b/glm/core/type_mat2x4.inl @@ -32,7 +32,7 @@ namespace detail size_type i ) { - assert(i >= size_type(0) && i < col_size()); + assert(i < col_size()); return this->value[i]; } @@ -43,7 +43,7 @@ namespace detail size_type i ) const { - assert(i >= size_type(0) && i < col_size()); + assert(i < col_size()); return this->value[i]; } diff --git a/glm/core/type_mat3x2.inl b/glm/core/type_mat3x2.inl index cbdc2821..24def0b2 100644 --- a/glm/core/type_mat3x2.inl +++ b/glm/core/type_mat3x2.inl @@ -32,7 +32,7 @@ namespace detail size_type i ) { - assert(i >= size_type(0) && i < col_size()); + assert(i < col_size()); return this->value[i]; } @@ -43,7 +43,7 @@ namespace detail size_type i ) const { - assert(i >= size_type(0) && i < col_size()); + assert(i < col_size()); return this->value[i]; } diff --git a/glm/core/type_mat3x3.inl b/glm/core/type_mat3x3.inl index 5ca1b2ed..58737054 100644 --- a/glm/core/type_mat3x3.inl +++ b/glm/core/type_mat3x3.inl @@ -32,7 +32,7 @@ namespace detail size_type i ) { - assert(i >= size_type(0) && i < col_size()); + assert(i < col_size()); return this->value[i]; } @@ -43,7 +43,7 @@ namespace detail size_type i ) const { - assert(i >= size_type(0) && i < col_size()); + assert(i < col_size()); return this->value[i]; } diff --git a/glm/core/type_mat3x4.inl b/glm/core/type_mat3x4.inl index 03963500..5bb9158f 100644 --- a/glm/core/type_mat3x4.inl +++ b/glm/core/type_mat3x4.inl @@ -32,7 +32,7 @@ namespace detail size_type i ) { - assert(i >= size_type(0) && i < col_size()); + assert(i < col_size()); return this->value[i]; } @@ -43,7 +43,7 @@ namespace detail size_type i ) const { - assert(i >= size_type(0) && i < col_size()); + assert(i < col_size()); return this->value[i]; } diff --git a/glm/core/type_mat4x2.inl b/glm/core/type_mat4x2.inl index c7107436..48117f28 100644 --- a/glm/core/type_mat4x2.inl +++ b/glm/core/type_mat4x2.inl @@ -32,7 +32,7 @@ namespace detail size_type i ) { - assert(i >= size_type(0) && i < col_size()); + assert(i < col_size()); return this->value[i]; } @@ -43,7 +43,7 @@ namespace detail size_type i ) const { - assert(i >= size_type(0) && i < col_size()); + assert(i < col_size()); return this->value[i]; } diff --git a/glm/core/type_mat4x3.inl b/glm/core/type_mat4x3.inl index f9324e7c..0ba1f17c 100644 --- a/glm/core/type_mat4x3.inl +++ b/glm/core/type_mat4x3.inl @@ -32,7 +32,7 @@ namespace detail size_type i ) { - assert(i >= size_type(0) && i < col_size()); + assert(i < col_size()); return this->value[i]; } @@ -43,7 +43,7 @@ namespace detail size_type i ) const { - assert(i >= size_type(0) && i < col_size()); + assert(i < col_size()); return this->value[i]; } diff --git a/glm/core/type_mat4x4.inl b/glm/core/type_mat4x4.inl index f96f782c..0152e4b4 100644 --- a/glm/core/type_mat4x4.inl +++ b/glm/core/type_mat4x4.inl @@ -32,7 +32,7 @@ namespace detail size_type i ) { - assert(i >= size_type(0) && i < col_size()); + assert(i < col_size()); return this->value[i]; } @@ -43,7 +43,7 @@ namespace detail size_type i ) const { - assert(i >= size_type(0) && i < col_size()); + assert(i < col_size()); return this->value[i]; } diff --git a/glm/core/type_vec1.inl b/glm/core/type_vec1.inl index 8b27c3e8..47c586a2 100644 --- a/glm/core/type_vec1.inl +++ b/glm/core/type_vec1.inl @@ -26,7 +26,7 @@ namespace glm size_type i ) { - assert(i >= size_type(0) && i < value_size()); + assert(i < value_size()); return (&x)[i]; } @@ -36,7 +36,7 @@ namespace glm size_type i ) const { - assert(i >= size_type(0) && i < value_size()); + assert(i < value_size()); return (&x)[i]; } diff --git a/glm/core/type_vec2.inl b/glm/core/type_vec2.inl index 4bd5a69b..4620b687 100644 --- a/glm/core/type_vec2.inl +++ b/glm/core/type_vec2.inl @@ -27,7 +27,7 @@ namespace glm size_type i ) { - assert(i >= size_type(0) && i < value_size()); + assert(i < value_size()); return (&x)[i]; } @@ -38,7 +38,7 @@ namespace glm size_type i ) const { - assert(i >= size_type(0) && i < value_size()); + assert(i < value_size()); return (&x)[i]; } diff --git a/glm/core/type_vec3.inl b/glm/core/type_vec3.inl index e652fa28..d2b1ae29 100644 --- a/glm/core/type_vec3.inl +++ b/glm/core/type_vec3.inl @@ -27,7 +27,7 @@ namespace glm size_type i ) { - assert(i >= size_type(0) && i < value_size()); + assert(i < value_size()); return (&x)[i]; } @@ -38,7 +38,7 @@ namespace glm size_type i ) const { - assert(i >= size_type(0) && i < value_size()); + assert(i < value_size()); return (&x)[i]; } diff --git a/glm/core/type_vec4.inl b/glm/core/type_vec4.inl index 1bcf20ca..cb2ff4cc 100644 --- a/glm/core/type_vec4.inl +++ b/glm/core/type_vec4.inl @@ -27,7 +27,7 @@ namespace glm size_type i ) { - assert(i >= size_type(0) && i < value_size()); + assert(i < value_size()); return (&x)[i]; } @@ -38,7 +38,7 @@ namespace glm size_type i ) const { - assert(i >= size_type(0) && i < value_size()); + assert(i < value_size()); return (&x)[i]; } From c866207fe046c941f6d3114720a3df1671163341 Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Thu, 8 Jul 2010 10:44:50 +0100 Subject: [PATCH 3/4] Fixed ticket #23 --- doc/src/dummy.cpp | 22 +++++++++++++++++++++- glm/gtx/comparison.hpp | 40 ++++++++++++++++++++++++++++++++++++---- 2 files changed, 57 insertions(+), 5 deletions(-) diff --git a/doc/src/dummy.cpp b/doc/src/dummy.cpp index 7188c829..226a7c76 100644 --- a/doc/src/dummy.cpp +++ b/doc/src/dummy.cpp @@ -1,4 +1,5 @@ #include "../../glm/glm.hpp" // glm::vec3, glm::vec4, glm::ivec4, glm::mat4 +#include struct triangle { @@ -17,12 +18,29 @@ void computeNormal(triangle & Triangle) #include "../../glm/gtc/matrix_projection.hpp" // glm::perspective #include "../../glm/gtc/matrix_transform.hpp" // glm::translate, glm::rotate, glm::scale #include "../../glm/gtc/type_ptr.hpp" // glm::value_ptr +#include "../../glm/gtc/quaternion.hpp" // glm::quat +#include "../../glm/gtx/comparison.hpp" // == != +//#include "../../glm/ext.hpp" glm::vec4 const ClearColor = glm::vec4(glm::vec3(0.0f), 1.0f); glm::ivec4 const Viewport = glm::ivec4(0, 0, 640, 480); void glUniformMatrix4fv(int location, int count, bool transpose, const float * value); +void ticket0023() +{ + std::vector vals; + vals.push_back(1); + vals.push_back(2); + vals.push_back(3); + std::vector::iterator it1, it2; + it1 = vals.begin(); + it2 = vals.end(); + it1 != it2; // <-- Here + glm::vec3 c; + glm::quat q; +} + int main() { //triangle Triangle; @@ -38,5 +56,7 @@ int main() glm::mat4 Model = glm::scale(glm::mat4(1.0f), glm::vec3(0.5f)); glm::mat4 MVP = Projection * View * Model; - glUniformMatrix4fv(LocationMVP, 1, GL_FALSE, glm::value_ptr(MVP)); + //glUniformMatrix4fv(LocationMVP, 1, GL_FALSE, glm::value_ptr(MVP)); + + ticket0023(); } diff --git a/glm/gtx/comparison.hpp b/glm/gtx/comparison.hpp index 8d12d5f6..a035e936 100644 --- a/glm/gtx/comparison.hpp +++ b/glm/gtx/comparison.hpp @@ -28,13 +28,45 @@ namespace glm //! Define == operator for vectors //! From GLM_GTX_comparison extension. - template - bool operator== (vecType const & x, vecType const & y); + template + bool operator== ( + detail::tvec2 const & x, + detail::tvec2 const & y); + + //! Define == operator for vectors + //! From GLM_GTX_comparison extension. + template + bool operator== ( + detail::tvec3 const & x, + detail::tvec3 const & y); + + //! Define == operator for vectors + //! From GLM_GTX_comparison extension. + template + bool operator== ( + detail::tvec4 const & x, + detail::tvec4 const & y); //! Define != operator for vectors //! From GLM_GTX_comparison extension. - template - bool operator!= (vecType const & x, vecType const & y); + template + bool operator!= ( + detail::tvec2 const & x, + detail::tvec2 const & y); + + //! Define != operator for vectors + //! From GLM_GTX_comparison extension. + template + bool operator!= ( + detail::tvec3 const & x, + detail::tvec3 const & y); + + //! Define != operator for vectors + //! From GLM_GTX_comparison extension. + template + bool operator!= ( + detail::tvec4 const & x, + detail::tvec4 const & y); }//namespace comparison }//namespace gtx From 2fb86e9b779982b3fb8eaf323bacc3c8fc98a1f0 Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Thu, 8 Jul 2010 11:05:33 +0100 Subject: [PATCH 4/4] Added GLM_GTX_int_10_10_10_2 --- glm/gtx/int_10_10_10_2.hpp | 39 ++++++++++++++++++++++++++++++++++++++ glm/gtx/int_10_10_10_2.inl | 28 +++++++++++++++++++++++++++ 2 files changed, 67 insertions(+) create mode 100644 glm/gtx/int_10_10_10_2.hpp create mode 100644 glm/gtx/int_10_10_10_2.inl diff --git a/glm/gtx/int_10_10_10_2.hpp b/glm/gtx/int_10_10_10_2.hpp new file mode 100644 index 00000000..0b48f6b7 --- /dev/null +++ b/glm/gtx/int_10_10_10_2.hpp @@ -0,0 +1,39 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2010 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2010-07-07 +// Updated : 2010-07-07 +// Licence : This source is under MIT License +// File : glm/gtx/int_10_10_10_2.hpp +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Dependency: +// - GLM core +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_gtx_int_10_10_10_2 +#define glm_gtx_int_10_10_10_2 + +// Dependency: +#include "../glm.hpp" + +namespace glm +{ + namespace gtx{ + //! GLM_GTX_int_10_10_10_2 extension: Add support for integer for core functions + namespace int_10_10_10_2 + { + //! From GLM_GTX_int_10_10_10_2 extension. + int int10_10_10_2_cast(glm::vec4 const & v); + + //! From GLM_GTX_int_10_10_10_2 extension. + uint uint10_10_10_2_cast(glm::vec4 const & v); + + }//namespace integer + }//namespace gtx +}//namespace glm + +#include "int_10_10_10_2.inl" + +namespace glm{using namespace gtx::int_10_10_10_2;} + +#endif//glm_gtx_int_10_10_10_2 diff --git a/glm/gtx/int_10_10_10_2.inl b/glm/gtx/int_10_10_10_2.inl new file mode 100644 index 00000000..28a87894 --- /dev/null +++ b/glm/gtx/int_10_10_10_2.inl @@ -0,0 +1,28 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2010 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2010-07-07 +// Updated : 2010-07-07 +// Licence : This source is under MIT License +// File : glm/gtx/int_10_10_10_2.inl +/////////////////////////////////////////////////////////////////////////////////////////////////// + +namespace glm{ +namespace gtx{ +namespace int_10_10_10_2 +{ + //! From GLM_GTX_int_10_10_10_2 extension. + int int10_10_10_2_cast(glm::vec4 const & v) + { + return int(v.x * 2047.f) << 0 | int(v.y * 2047.f) << 10 | int(v.z * 2047.f) << 20 | int(v.w * 3.f) << 30; + } + + //! From GLM_GTX_int_10_10_10_2 extension. + uint uint10_10_10_2_cast(glm::vec4 const & v) + { + return uint(v.x * 2047.f) << 0 | uint(v.y * 2047.f) << 10 | uint(v.z * 2047.f) << 20 | uint(v.w * 3.f) << 30; + } + +}//namespace int_10_10_10_2 +}//namespace gtx +}//namespace glm