diff --git a/glm/gtc/packing.hpp b/glm/gtc/packing.hpp new file mode 100644 index 00000000..0f366384 --- /dev/null +++ b/glm/gtc/packing.hpp @@ -0,0 +1,115 @@ +/////////////////////////////////////////////////////////////////////////////////// +/// 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_packing +/// @file glm/gtc/packing.hpp +/// @date 2013-08-08 / 2013-08-08 +/// @author Christophe Riccio +/// +/// @see core (dependence) +/// +/// @defgroup gtc_packing GLM_GTC_packing +/// @ingroup gtc +/// +/// @brief This extension provides a set of function to convert vertors to packed +/// formats. +/// +/// need to be included to use these features. +/////////////////////////////////////////////////////////////////////////////////// + +#ifndef GLM_GTC_packing +#define GLM_GTC_packing GLM_VERSION + +// Dependency: +#include "../glm.hpp" + +#if(defined(GLM_MESSAGES) && !defined(glm_ext)) +# pragma message("GLM: GLM_GTC_packing extension included") +#endif + +namespace glm +{ + /// @addtogroup gtc_packing + /// @{ + + uint16 packUnorm1x16(float v); + float unpackUnorm1x16(uint16 v); + + uint64 packUnorm4x16(vec4 const & v); + vec4 unpackUnorm4x16(uint64 const & v); + + uint16 packSnorm1x16(float v); + float unpackSnorm1x16(uint16 v); + + uint64 packSnorm4x16(vec4 const & v); + vec4 unpackSnorm4x16(uint64 const & v); + + uint16 packUnorm2x8(vec2 const & v); + vec2 unpackUnorm2x8(uint16 v); + + uint16 packSnorm2x8(vec2 const & v); + vec2 unpackSnorm2x8(uint16 v); + + GLM_FUNC_DECL uint16 packHalf1x16(float const & v); + GLM_FUNC_DECL float unpackHalf1x16(uint16 const & v); + + /// Returns an unsigned integer obtained by converting the components of a two-component floating-point vector + /// to the 16-bit floating-point representation found in the OpenGL Specification, + /// and then packing these two 16- bit integers into a 32-bit unsigned integer. + /// The first vector component specifies the 16 least-significant bits of the result; + /// the second component specifies the 16 most-significant bits. + /// + /// @see gtc_packing + /// @see GLSL packHalf2x16 man page + /// @see GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions + GLM_FUNC_DECL uint64 packHalf4x16(vec4 const & v); + + /// Returns a two-component floating-point vector with components obtained by unpacking a 32-bit unsigned integer into a pair of 16-bit values, + /// interpreting those values as 16-bit floating-point numbers according to the OpenGL Specification, + /// and converting them to 32-bit floating-point values. + /// The first component of the vector is obtained from the 16 least-significant bits of v; + /// the second component is obtained from the 16 most-significant bits of v. + /// + /// @see gtc_packing + /// @see GLSL unpackHalf2x16 man page + /// @see GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions + GLM_FUNC_DECL vec4 unpackHalf4x16(uint64 const & v); + + GLM_FUNC_DECL uint32 packSnorm3x10Snorm1x2(vec4 const & v); + GLM_FUNC_DECL vec4 unpackSnorm3x10Snorm1x2(uint32 const & v); + + GLM_FUNC_DECL uint32 packI3x10I1x2(ivec4 const & v); + GLM_FUNC_DECL ivec4 unpackI3x10I1x2(uint32 const & v); + + GLM_FUNC_DECL uint32 packU3x10U1x2(uvec4 const & v); + GLM_FUNC_DECL uvec4 unpackU3x10U1x2(uint32 const & v); + + GLM_FUNC_DECL uint32 packF11F11F10(vec3 const & v); + GLM_FUNC_DECL vec3 unpackF11F11F10(uint32 const & v); + + /// @} +}// namespace glm + +#include "packing.inl" + +#endif//GLM_GTC_packing + diff --git a/glm/gtc/packing.inl b/glm/gtc/packing.inl new file mode 100644 index 00000000..dcaa12f3 --- /dev/null +++ b/glm/gtc/packing.inl @@ -0,0 +1,32 @@ +/////////////////////////////////////////////////////////////////////////////////// +/// 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_packing +/// @file glm/gtc/packing.inl +/// @date 2013-08-08 / 2013-08-08 +/// @author Christophe Riccio +/////////////////////////////////////////////////////////////////////////////////// + +namespace glm +{ + +}//namespace glm diff --git a/test/core/core_type_vec2.cpp b/test/core/core_type_vec2.cpp index 6f2b2560..ebdf2306 100644 --- a/test/core/core_type_vec2.cpp +++ b/test/core/core_type_vec2.cpp @@ -230,7 +230,7 @@ int test_operator_increment() glm::ivec2 v3 = ++v1; glm::ivec2 v4 = v2++; - Error += glm::all(glm::equal(v0, v4)) ? 0 : 1; + Error += glm::all(glm::equal(v0, v4)) ? 0 : 1; Error += glm::all(glm::equal(v1, v2)) ? 0 : 1; Error += glm::all(glm::equal(v1, v3)) ? 0 : 1;