From 8e955736acf493c0a363eb73557c6013b4709ea7 Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Sat, 31 Aug 2013 12:00:10 +0200 Subject: [PATCH] Removed GTC_swizzle --- glm/gtc/swizzle.hpp | 381 --------------------------------------- glm/gtc/swizzle.inl | 116 ------------ test/gtc/CMakeLists.txt | 1 - test/gtc/gtc_swizzle.cpp | 203 --------------------- 4 files changed, 701 deletions(-) delete mode 100644 glm/gtc/swizzle.hpp delete mode 100644 glm/gtc/swizzle.inl delete mode 100644 test/gtc/gtc_swizzle.cpp diff --git a/glm/gtc/swizzle.hpp b/glm/gtc/swizzle.hpp deleted file mode 100644 index 3b54972f..00000000 --- a/glm/gtc/swizzle.hpp +++ /dev/null @@ -1,381 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////////// -/// 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 gtc_swizzle -/// @file glm/gtc/swizzle.hpp -/// @date 2010-02-20 / 2011-06-05 -/// @author Christophe Riccio -/// -/// @see core (dependence) -/// -/// @defgroup gtc_swizzle GLM_GTC_swizzle -/// @ingroup gtc -/// -/// @brief Provide functions to emulate GLSL swizzle operator fonctionalities. -/// -/// need to be included to use these functionalities. -/////////////////////////////////////////////////////////////////////////////////// - -#ifndef GLM_GTC_swizzle -#define GLM_GTC_swizzle GLM_VERSION - -// Dependency: -#include "../glm.hpp" -#include "../gtc/type_precision.hpp" - -#if(defined(GLM_MESSAGES) && !defined(glm_ext)) -# pragma message("GLM: GLM_GTC_swizzle extension included") -#endif - -namespace glm -{ - /// @addtogroup gtc_swizzle - /// @{ - - template class vecType> - T const & swizzle( - vecType const & v, - comp x); - - template class vecType> - detail::tvec2 const & swizzle( - vecType const & v, - comp x, comp y); - - template class vecType> - detail::tvec3 const & swizzle( - vecType const & v, - comp x, comp y, comp z); - - template class vecType> - detail::tvec4 const & swizzle( - vecType const & v, - comp x, comp y, comp z, comp w); - - template class vecType> - T & swizzle( - vecType & v, - comp x); - - template class vecType> - detail::tref2 swizzle( - vecType & v, - comp x, comp y); - - template class vecType> - detail::tref3 swizzle( - vecType & v, - comp x, comp y, comp z); - - template class vecType> - detail::tref4 swizzle( - vecType & v, - comp x, comp y, comp z, comp w); - -# define static_swizzle1_const(TYPE, SIZE) \ - template \ - GLM_FUNC_QUALIFIER TYPE swizzle(detail::tvec##SIZE const & v) \ - {return v[x];} - -# define static_swizzle1_ref(TYPE, SIZE) \ - template \ - GLM_FUNC_QUALIFIER TYPE& swizzle(detail::tvec##SIZE & v) \ - {return v[x];} - - static_swizzle1_ref(detail::float16, 2) - static_swizzle1_ref(detail::float16, 3) - static_swizzle1_ref(detail::float16, 4) - static_swizzle1_ref(detail::float32, 2) - static_swizzle1_ref(detail::float32, 3) - static_swizzle1_ref(detail::float32, 4) - static_swizzle1_ref(detail::float64, 2) - static_swizzle1_ref(detail::float64, 3) - static_swizzle1_ref(detail::float64, 4) - - static_swizzle1_ref(detail::int8, 2) - static_swizzle1_ref(detail::int8, 3) - static_swizzle1_ref(detail::int8, 4) - static_swizzle1_ref(detail::int16, 2) - static_swizzle1_ref(detail::int16, 3) - static_swizzle1_ref(detail::int16, 4) - static_swizzle1_ref(detail::int32, 2) - static_swizzle1_ref(detail::int32, 3) - static_swizzle1_ref(detail::int32, 4) - static_swizzle1_ref(detail::int64, 2) - static_swizzle1_ref(detail::int64, 3) - static_swizzle1_ref(detail::int64, 4) - - static_swizzle1_ref(detail::uint8, 2) - static_swizzle1_ref(detail::uint8, 3) - static_swizzle1_ref(detail::uint8, 4) - static_swizzle1_ref(detail::uint16, 2) - static_swizzle1_ref(detail::uint16, 3) - static_swizzle1_ref(detail::uint16, 4) - static_swizzle1_ref(detail::uint32, 2) - static_swizzle1_ref(detail::uint32, 3) - static_swizzle1_ref(detail::uint32, 4) - static_swizzle1_ref(detail::uint64, 2) - static_swizzle1_ref(detail::uint64, 3) - static_swizzle1_ref(detail::uint64, 4) -/* -# define static_swizzle2_const(TYPE) \ - template \ - GLM_FUNC_QUALIFIER TYPE swizzle(TYPE const & v) \ - {return TYPE(v[x], v[y]);} - -# define static_swizzle3_const(TYPE) \ - template \ - GLM_FUNC_QUALIFIER TYPE swizzle(TYPE const & v) \ - {return TYPE(v[x], v[y], v[z]);} - -# define static_swizzle4_const(TYPE) \ - template \ - GLM_FUNC_QUALIFIER TYPE swizzle(TYPE const & v) \ - {return TYPE(v[x], v[y], v[z], v[w]);} -*/ - -# define static_swizzle2_const(TYPE, SIZE) \ - template \ - GLM_FUNC_QUALIFIER detail::tvec2 swizzle( \ - detail::tvec##SIZE const & v) \ - {return detail::tvec2(v[x], v[y]);} - -# define static_swizzle3_const(TYPE, SIZE) \ - template \ - GLM_FUNC_QUALIFIER detail::tvec3 swizzle( \ - detail::tvec##SIZE const & v) \ - {return detail::tvec3(v[x], v[y], v[z]);} - -# define static_swizzle4_const(TYPE, SIZE) \ - template \ - GLM_FUNC_QUALIFIER detail::tvec4 swizzle( \ - detail::tvec##SIZE const & v) \ - {return detail::tvec4(v[x], v[y], v[z], v[w]);} - - - static_swizzle2_const(glm::f16, 2) - static_swizzle2_const(glm::f16, 3) - static_swizzle2_const(glm::f16, 4) - static_swizzle2_const(glm::f32, 2) - static_swizzle2_const(glm::f32, 3) - static_swizzle2_const(glm::f32, 4) - static_swizzle2_const(glm::f64, 2) - static_swizzle2_const(glm::f64, 3) - static_swizzle2_const(glm::f64, 4) - - static_swizzle2_const(glm::i8, 2) - static_swizzle2_const(glm::i8, 3) - static_swizzle2_const(glm::i8, 4) - static_swizzle2_const(glm::i16, 2) - static_swizzle2_const(glm::i16, 3) - static_swizzle2_const(glm::i16, 4) - static_swizzle2_const(glm::i32, 2) - static_swizzle2_const(glm::i32, 3) - static_swizzle2_const(glm::i32, 4) - static_swizzle2_const(glm::i64, 2) - static_swizzle2_const(glm::i64, 3) - static_swizzle2_const(glm::i64, 4) - - static_swizzle2_const(glm::u8, 2) - static_swizzle2_const(glm::u8, 3) - static_swizzle2_const(glm::u8, 4) - static_swizzle2_const(glm::u16, 2) - static_swizzle2_const(glm::u16, 3) - static_swizzle2_const(glm::u16, 4) - static_swizzle2_const(glm::u32, 2) - static_swizzle2_const(glm::u32, 3) - static_swizzle2_const(glm::u32, 4) - static_swizzle2_const(glm::u64, 2) - static_swizzle2_const(glm::u64, 3) - static_swizzle2_const(glm::u64, 4) - - static_swizzle3_const(glm::f16, 2) - static_swizzle3_const(glm::f16, 3) - static_swizzle3_const(glm::f16, 4) - static_swizzle3_const(glm::f32, 2) - static_swizzle3_const(glm::f32, 3) - static_swizzle3_const(glm::f32, 4) - static_swizzle3_const(glm::f64, 2) - static_swizzle3_const(glm::f64, 3) - static_swizzle3_const(glm::f64, 4) - - static_swizzle3_const(glm::i8, 2) - static_swizzle3_const(glm::i8, 3) - static_swizzle3_const(glm::i8, 4) - static_swizzle3_const(glm::i16, 2) - static_swizzle3_const(glm::i16, 3) - static_swizzle3_const(glm::i16, 4) - static_swizzle3_const(glm::i32, 2) - static_swizzle3_const(glm::i32, 3) - static_swizzle3_const(glm::i32, 4) - static_swizzle3_const(glm::i64, 2) - static_swizzle3_const(glm::i64, 3) - static_swizzle3_const(glm::i64, 4) - - static_swizzle3_const(glm::u8, 2) - static_swizzle3_const(glm::u8, 3) - static_swizzle3_const(glm::u8, 4) - static_swizzle3_const(glm::u16, 2) - static_swizzle3_const(glm::u16, 3) - static_swizzle3_const(glm::u16, 4) - static_swizzle3_const(glm::u32, 2) - static_swizzle3_const(glm::u32, 3) - static_swizzle3_const(glm::u32, 4) - static_swizzle3_const(glm::u64, 2) - static_swizzle3_const(glm::u64, 3) - static_swizzle3_const(glm::u64, 4) - - static_swizzle4_const(glm::f16, 2) - static_swizzle4_const(glm::f16, 3) - static_swizzle4_const(glm::f16, 4) - static_swizzle4_const(glm::f32, 2) - static_swizzle4_const(glm::f32, 3) - static_swizzle4_const(glm::f32, 4) - static_swizzle4_const(glm::f64, 2) - static_swizzle4_const(glm::f64, 3) - static_swizzle4_const(glm::f64, 4) - - static_swizzle4_const(glm::i8, 2) - static_swizzle4_const(glm::i8, 3) - static_swizzle4_const(glm::i8, 4) - static_swizzle4_const(glm::i16, 2) - static_swizzle4_const(glm::i16, 3) - static_swizzle4_const(glm::i16, 4) - static_swizzle4_const(glm::i32, 2) - static_swizzle4_const(glm::i32, 3) - static_swizzle4_const(glm::i32, 4) - static_swizzle4_const(glm::i64, 2) - static_swizzle4_const(glm::i64, 3) - static_swizzle4_const(glm::i64, 4) - - static_swizzle4_const(glm::u8, 2) - static_swizzle4_const(glm::u8, 3) - static_swizzle4_const(glm::u8, 4) - static_swizzle4_const(glm::u16, 2) - static_swizzle4_const(glm::u16, 3) - static_swizzle4_const(glm::u16, 4) - static_swizzle4_const(glm::u32, 2) - static_swizzle4_const(glm::u32, 3) - static_swizzle4_const(glm::u32, 4) - static_swizzle4_const(glm::u64, 2) - static_swizzle4_const(glm::u64, 3) - static_swizzle4_const(glm::u64, 4) - -# define static_swizzle2_ref(TYPE, SIZE) \ - template \ - GLM_FUNC_QUALIFIER glm::detail::tref2 swizzle( \ - detail::tvec##SIZE & v) \ - {return glm::detail::tref2(v[x], v[y]);} - -# define static_swizzle3_ref(TYPE, SIZE) \ - template \ - GLM_FUNC_QUALIFIER glm::detail::tref3 swizzle( \ - detail::tvec##SIZE & v) \ - {return glm::detail::tref3(v[x], v[y], v[z]);} - -# define static_swizzle4_ref(TYPE, SIZE) \ - template \ - GLM_FUNC_QUALIFIER glm::detail::tref4 swizzle( \ - detail::tvec##SIZE & v) \ - {return glm::detail::tref4(v[x], v[y], v[z], v[w]);} - - static_swizzle2_ref(glm::f16, 2) - static_swizzle2_ref(glm::f16, 3) - static_swizzle2_ref(glm::f16, 4) - static_swizzle2_ref(glm::f32, 2) - static_swizzle2_ref(glm::f32, 3) - static_swizzle2_ref(glm::f32, 4) - static_swizzle2_ref(glm::f64, 2) - static_swizzle2_ref(glm::f64, 3) - static_swizzle2_ref(glm::f64, 4) - - static_swizzle2_ref(glm::i8, 2) - static_swizzle2_ref(glm::i8, 3) - static_swizzle2_ref(glm::i8, 4) - static_swizzle2_ref(glm::i16, 2) - static_swizzle2_ref(glm::i16, 3) - static_swizzle2_ref(glm::i16, 4) - static_swizzle2_ref(glm::i32, 2) - static_swizzle2_ref(glm::i32, 3) - static_swizzle2_ref(glm::i32, 4) - static_swizzle2_ref(glm::i64, 2) - static_swizzle2_ref(glm::i64, 3) - static_swizzle2_ref(glm::i64, 4) - - static_swizzle2_ref(glm::u8, 2) - static_swizzle2_ref(glm::u8, 3) - static_swizzle2_ref(glm::u8, 4) - static_swizzle2_ref(glm::u16, 2) - static_swizzle2_ref(glm::u16, 3) - static_swizzle2_ref(glm::u16, 4) - static_swizzle2_ref(glm::u32, 2) - static_swizzle2_ref(glm::u32, 3) - static_swizzle2_ref(glm::u32, 4) - static_swizzle2_ref(glm::u64, 2) - static_swizzle2_ref(glm::u64, 3) - static_swizzle2_ref(glm::u64, 4) - - static_swizzle3_ref(glm::f16, 3) - static_swizzle3_ref(glm::f16, 4) - static_swizzle3_ref(glm::f32, 3) - static_swizzle3_ref(glm::f32, 4) - static_swizzle3_ref(glm::f64, 3) - static_swizzle3_ref(glm::f64, 4) - - static_swizzle3_ref(glm::i8, 3) - static_swizzle3_ref(glm::i8, 4) - static_swizzle3_ref(glm::i16, 3) - static_swizzle3_ref(glm::i16, 4) - static_swizzle3_ref(glm::i32, 3) - static_swizzle3_ref(glm::i32, 4) - static_swizzle3_ref(glm::i64, 3) - static_swizzle3_ref(glm::i64, 4) - - static_swizzle3_ref(glm::u8, 3) - static_swizzle3_ref(glm::u8, 4) - static_swizzle3_ref(glm::u16, 3) - static_swizzle3_ref(glm::u16, 4) - static_swizzle3_ref(glm::u32, 3) - static_swizzle3_ref(glm::u32, 4) - static_swizzle3_ref(glm::u64, 3) - static_swizzle3_ref(glm::u64, 4) - - static_swizzle4_ref(glm::f16, 4) - static_swizzle4_ref(glm::f32, 4) - static_swizzle4_ref(glm::f64, 4) - - static_swizzle4_ref(glm::i8, 4) - static_swizzle4_ref(glm::i16, 4) - static_swizzle4_ref(glm::i32, 4) - static_swizzle4_ref(glm::i64, 4) - - static_swizzle4_ref(glm::u8, 4) - static_swizzle4_ref(glm::u16, 4) - static_swizzle4_ref(glm::u32, 4) - static_swizzle4_ref(glm::u64, 4) - - /// @} -}//namespace glm - -#include "swizzle.inl" - -#endif//GLM_GTC_swizzle diff --git a/glm/gtc/swizzle.inl b/glm/gtc/swizzle.inl deleted file mode 100644 index 9bd47ced..00000000 --- a/glm/gtc/swizzle.inl +++ /dev/null @@ -1,116 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////////// -/// 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 gtc_swizzle -/// @file glm/gtc/swizzle.inl -/// @date 2011-01-15 / 2011-06-15 -/// @author Christophe Riccio -/////////////////////////////////////////////////////////////////////////////////// - -namespace glm -{ - template class vecType> - GLM_FUNC_QUALIFIER T swizzle - ( - vecType const & v, - comp x - ) - { - assert(int(x) < int(vecType::value_size)); - return v[x]; - } - - template class vecType> - GLM_FUNC_QUALIFIER detail::tvec2 swizzle - ( - vecType const & v, - comp x, comp y - ) - { - return detail::tvec2( - v[x], - v[y]); - } - - template class vecType> - GLM_FUNC_QUALIFIER detail::tvec3 swizzle - ( - vecType const & v, - comp x, comp y, comp z - ) - { - return detail::tvec3( - v[x], - v[y], - v[z]); - } - - template class vecType> - GLM_FUNC_QUALIFIER detail::tvec4 swizzle - ( - vecType const & v, - comp x, comp y, comp z, comp w - ) - { - return detail::tvec4(v[x], v[y], v[z], v[w]); - } - - template - GLM_FUNC_QUALIFIER T& swizzle - ( - detail::tvec4 & v, - comp x - ) - { - return v[x]; - } - - template - GLM_FUNC_QUALIFIER detail::tref2 swizzle - ( - detail::tvec4 & v, - comp x, comp y - ) - { - return detail::tref2(v[x], v[y]); - } - - template - GLM_FUNC_QUALIFIER detail::tref3 swizzle - ( - detail::tvec4 & v, - comp x, comp y, comp z - ) - { - return detail::tref3(v[x], v[y], v[z]); - } - - template - GLM_FUNC_QUALIFIER detail::tref4 swizzle - ( - detail::tvec4 & v, - comp x, comp y, comp z, comp w - ) - { - return detail::tref4(v[x], v[y], v[z], v[w]); - } -}//namespace glm diff --git a/test/gtc/CMakeLists.txt b/test/gtc/CMakeLists.txt index 62c33063..85f63a65 100644 --- a/test/gtc/CMakeLists.txt +++ b/test/gtc/CMakeLists.txt @@ -10,7 +10,6 @@ glmCreateTestGTC(gtc_packing) glmCreateTestGTC(gtc_quaternion) glmCreateTestGTC(gtc_random) glmCreateTestGTC(gtc_reciprocal) -glmCreateTestGTC(gtc_swizzle) glmCreateTestGTC(gtc_type_precision) glmCreateTestGTC(gtc_type_ptr) glmCreateTestGTC(gtc_ulp) diff --git a/test/gtc/gtc_swizzle.cpp b/test/gtc/gtc_swizzle.cpp deleted file mode 100644 index 2b72155d..00000000 --- a/test/gtc/gtc_swizzle.cpp +++ /dev/null @@ -1,203 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////////////////////////// -// OpenGL Mathematics Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) -/////////////////////////////////////////////////////////////////////////////////////////////////// -// Created : 2010-09-16 -// Updated : 2010-09-16 -// Licence : This source is under MIT licence -// File : test/gtc/swizzle.cpp -/////////////////////////////////////////////////////////////////////////////////////////////////// - -#include -#include - -int test_swizzle_vec4_ref_dynamic() -{ - int Error = 0; - - { - glm::ivec4 A(0, 1, 2, 3); - glm::ivec4 B(2, 1, 0, 3); - glm::swizzle(A, glm::Z, glm::Y, glm::X, glm::W) = B; - Error += (A.z == B.x && A.y == B.y && A.x == B.z && A.w == B.w) ? 0 : 1; - } - - { - glm::ivec4 A(0, 1, 2, 3); - glm::ivec3 B(2, 1, 0); - glm::swizzle(A, glm::Z, glm::Y, glm::X) = B; - Error += (A.z == B.x && A.y == B.y && A.x == B.z) ? 0 : 1; - } - - { - glm::ivec4 A(0, 1, 2, 3); - glm::ivec2 B(2, 1); - glm::swizzle(A, glm::Z, glm::Y) = B; - Error += (A.z == B.x && A.y == B.y) ? 0 : 1; - } - - { - glm::ivec4 A(0, 1, 2, 3); - int B(2); - glm::swizzle(A, glm::Z) = B; - Error += (A.z == B) ? 0 : 1; - } - - return Error; -} - -int test_swizzle_vec4_ref_static() -{ - int Error = 0; - - { - glm::ivec4 A(0, 1, 2, 3); - glm::ivec4 B(2, 1, 0, 3); - glm::swizzle(A) = B; - Error += (A.z == B.x && A.y == B.y && A.x == B.z && A.w == B.w) ? 0 : 1; - } - - { - glm::ivec4 A(0, 1, 2, 3); - glm::ivec3 B(2, 1, 0); - glm::swizzle(A) = B; - Error += (A.z == B.x && A.y == B.y && A.x == B.z) ? 0 : 1; - } - - { - glm::ivec4 A(0, 1, 2, 3); - glm::ivec2 B(2, 1); - glm::swizzle(A) = B; - Error += (A.z == B.x && A.y == B.y) ? 0 : 1; - } - - { - glm::ivec4 A(0, 1, 2, 3); - int B(2); - glm::swizzle(A) = B; - Error += (A.z == B) ? 0 : 1; - } - - return Error; -} - -int test_swizzle_vec4_const_dynamic() -{ - int Error = 0; - - glm::ivec4 A(0, 1, 2, 3); - glm::ivec4 B = glm::swizzle(A, glm::B, glm::G, glm::R, glm::A); - Error += (glm::all(glm::equal(glm::ivec4(2, 1, 0, 3), B))) ? 0 : 1; - - glm::ivec3 C = glm::swizzle(A, glm::W, glm::Y, glm::Z); - Error += (glm::all(glm::equal(glm::ivec3(3, 1, 2), C))) ? 0 : 1; - - glm::ivec2 D = glm::swizzle(A, glm::W, glm::X); - Error += (glm::all(glm::equal(glm::ivec2(3, 0), D))) ? 0 : 1; - - int E = glm::swizzle(A, glm::Q); - Error += (E == 3) ? 0 : 1; - - return Error; -} - -int test_swizzle_vec4_const_static() -{ - int Error = 0; - - glm::ivec4 A(0, 1, 2, 3); - - glm::ivec4 B = glm::swizzle(A); - Error += (glm::all(glm::equal(glm::ivec4(2, 1, 0, 3), B))) ? 0 : 1; - - glm::ivec3 C = glm::swizzle(A); - Error += (glm::all(glm::equal(glm::ivec3(3, 1, 2), C))) ? 0 : 1; - - glm::ivec2 D = glm::swizzle(A); - Error += (glm::all(glm::equal(glm::ivec2(3, 0), D))) ? 0 : 1; - - int E = glm::swizzle(A); - Error += (E == 3) ? 0 : 1; - - return Error; -} - -int test_swizzle_vec3_partial() -{ - int Error = 0; - - glm::ivec3 A(0, 1, 2); - - { - glm::ivec3 B(A.swizzle(glm::R, glm::G, glm::B)); - Error += (A == B) ? 0 : 1; - } - - { - glm::ivec3 B(A.swizzle(glm::R, glm::G), 2); - Error += (A == B) ? 0 : 1; - } - - { - glm::ivec3 B(0, A.swizzle(glm::G, glm::B)); - Error += (A == B) ? 0 : 1; - } - - return Error; -} - -int test_swizzle_vec4_partial() -{ - int Error = 0; - - glm::ivec4 A(0, 1, 2, 3); - - { - glm::ivec4 B(A.swizzle(glm::R, glm::G, glm::B), 3); - Error += (A == B) ? 0 : 1; - } - - { - glm::ivec4 B(A.swizzle(glm::R, glm::G), 2, 3); - Error += (A == B) ? 0 : 1; - } - - { - glm::ivec4 B(0, A.swizzle(glm::G, glm::B), 3); - Error += (A == B) ? 0 : 1; - } - - { - glm::ivec4 B(0, 1, A.swizzle(glm::B, glm::A)); - Error += (A == B) ? 0 : 1; - } - - { - glm::ivec4 B(A.swizzle(glm::X, glm::Y), A.swizzle(glm::Z, glm::W)); - Error += (A == B) ? 0 : 1; - } - - { - glm::ivec4 B(A.swizzle(glm::X, glm::Y), glm::vec2(2, 3)); - Error += (A == B) ? 0 : 1; - } - - { - glm::ivec4 B(glm::vec2(0, 1), A.swizzle(glm::Z, glm::W)); - Error += (A == B) ? 0 : 1; - } - - return Error; -} - -int main() -{ - int Error = 0; - Error += test_swizzle_vec3_partial(); - Error += test_swizzle_vec4_ref_dynamic(); - Error += test_swizzle_vec4_ref_static(); - Error += test_swizzle_vec4_const_dynamic(); - Error += test_swizzle_vec4_const_static(); - Error += test_swizzle_vec4_partial(); - - return Error; -}