1b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG/////////////////////////////////////////////////////////////////////////////////// 2b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG/// OpenGL Mathematics (glm.g-truc.net) 3b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG/// 4b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG/// Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net) 5b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG/// Permission is hereby granted, free of charge, to any person obtaining a copy 6b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG/// of this software and associated documentation files (the "Software"), to deal 7b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG/// in the Software without restriction, including without limitation the rights 8b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG/// copies of the Software, and to permit persons to whom the Software is 10b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG/// furnished to do so, subject to the following conditions: 11b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG/// 12b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG/// The above copyright notice and this permission notice shall be included in 13b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG/// all copies or substantial portions of the Software. 14b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG/// 15b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG/// THE SOFTWARE. 22b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG/// 23b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG/// @ref core 24b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG/// @file glm/core/func_packing.hpp 25b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG/// @date 2010-03-17 / 2011-06-15 26b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG/// @author Christophe Riccio 27b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG/// 28b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a> 29b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG/// 30b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG/// @defgroup core_func_packing Floating-Point Pack and Unpack Functions 31b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG/// @ingroup core 32b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG/// 33b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG/// These functions do not operate component-wise, rather as described in each case. 34b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG/////////////////////////////////////////////////////////////////////////////////// 35b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG 36b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG#ifndef GLM_CORE_func_packing 37b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG#define GLM_CORE_func_packing 38b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG 39b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG#include "type_vec2.hpp" 40b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG#include "type_vec4.hpp" 41b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG 42b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarGnamespace glm 43b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG{ 44b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG /// @addtogroup core_func_packing 45b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG /// @{ 46b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG 47b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG /// First, converts each component of the normalized floating-point value v into 8- or 16-bit integer values. 48b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG /// Then, the results are packed into the returned 32-bit unsigned integer. 49b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG /// 50b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG /// The conversion for component c of v to fixed point is done as follows: 51b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG /// packUnorm2x16: round(clamp(c, 0, +1) * 65535.0) 52b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG /// 53b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG /// The first component of the vector will be written to the least significant bits of the output; 54b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG /// the last component will be written to the most significant bits. 55b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG /// 56b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/packUnorm2x16.xml">GLSL packUnorm2x16 man page</a> 57b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG /// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a> 58b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG GLM_FUNC_DECL uint packUnorm2x16(vec2 const & v); 59b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG 60b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG /// First, converts each component of the normalized floating-point value v into 8- or 16-bit integer values. 61b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG /// Then, the results are packed into the returned 32-bit unsigned integer. 62b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG /// 63b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG /// The conversion for component c of v to fixed point is done as follows: 64b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG /// packSnorm2x16: round(clamp(v, -1, +1) * 32767.0) 65b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG /// 66b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG /// The first component of the vector will be written to the least significant bits of the output; 67b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG /// the last component will be written to the most significant bits. 68b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG /// 69b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/packSnorm2x16.xml">GLSL packSnorm2x16 man page</a> 70b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG /// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a> 71b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG GLM_FUNC_DECL uint packSnorm2x16(vec2 const & v); 72b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG 73b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG /// First, converts each component of the normalized floating-point value v into 8- or 16-bit integer values. 74b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG /// Then, the results are packed into the returned 32-bit unsigned integer. 75b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG /// 76b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG /// The conversion for component c of v to fixed point is done as follows: 77b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG /// packUnorm4x8: round(clamp(c, 0, +1) * 255.0) 78b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG /// 79b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG /// The first component of the vector will be written to the least significant bits of the output; 80b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG /// the last component will be written to the most significant bits. 81b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG /// 82b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/packUnorm4x8.xml">GLSL packUnorm4x8 man page</a> 83b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG /// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a> 84b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG GLM_FUNC_DECL uint packUnorm4x8(vec4 const & v); 85b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG 86b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG /// First, converts each component of the normalized floating-point value v into 8- or 16-bit integer values. 87b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG /// Then, the results are packed into the returned 32-bit unsigned integer. 88b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG /// 89b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG /// The conversion for component c of v to fixed point is done as follows: 90b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG /// packSnorm4x8: round(clamp(c, -1, +1) * 127.0) 91b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG /// 92b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG /// The first component of the vector will be written to the least significant bits of the output; 93b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG /// the last component will be written to the most significant bits. 94b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG /// 95b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/packSnorm4x8.xml">GLSL packSnorm4x8 man page</a> 96b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG /// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a> 97b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG GLM_FUNC_DECL uint packSnorm4x8(vec4 const & v); 98b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG 99b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG /// First, unpacks a single 32-bit unsigned integer p into a pair of 16-bit unsigned integers, four 8-bit unsigned integers, or four 8-bit signed integers. 100b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG /// Then, each component is converted to a normalized floating-point value to generate the returned two- or four-component vector. 101b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG /// 102b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG /// The conversion for unpacked fixed-point value f to floating point is done as follows: 103b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG /// unpackUnorm2x16: f / 65535.0 104b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG /// 105b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG /// The first component of the returned vector will be extracted from the least significant bits of the input; 106b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG /// the last component will be extracted from the most significant bits. 107b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG /// 108b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackUnorm2x16.xml">GLSL unpackUnorm2x16 man page</a> 109b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG /// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a> 110b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG GLM_FUNC_DECL vec2 unpackUnorm2x16(uint const & p); 111b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG 112b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG /// First, unpacks a single 32-bit unsigned integer p into a pair of 16-bit unsigned integers, four 8-bit unsigned integers, or four 8-bit signed integers. 113b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG /// Then, each component is converted to a normalized floating-point value to generate the returned two- or four-component vector. 114b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG /// 115b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG /// The conversion for unpacked fixed-point value f to floating point is done as follows: 116b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG /// unpackSnorm2x16: clamp(f / 32767.0, -1, +1) 117b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG /// 118b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG /// The first component of the returned vector will be extracted from the least significant bits of the input; 119b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG /// the last component will be extracted from the most significant bits. 120b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG /// 121b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackSnorm2x16.xml">GLSL unpackSnorm2x16 man page</a> 122b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG /// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a> 123b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG GLM_FUNC_DECL vec2 unpackSnorm2x16(uint const & p); 124b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG 125b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG /// First, unpacks a single 32-bit unsigned integer p into a pair of 16-bit unsigned integers, four 8-bit unsigned integers, or four 8-bit signed integers. 126b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG /// Then, each component is converted to a normalized floating-point value to generate the returned two- or four-component vector. 127b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG /// 128b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG /// The conversion for unpacked fixed-point value f to floating point is done as follows: 129b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG /// unpackUnorm4x8: f / 255.0 130b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG /// 131b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG /// The first component of the returned vector will be extracted from the least significant bits of the input; 132b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG /// the last component will be extracted from the most significant bits. 133b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG /// 134b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackUnorm4x8.xml">GLSL unpackUnorm4x8 man page</a> 135b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG /// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a> 136b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG GLM_FUNC_DECL vec4 unpackUnorm4x8(uint const & p); 137b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG 138b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG /// First, unpacks a single 32-bit unsigned integer p into a pair of 16-bit unsigned integers, four 8-bit unsigned integers, or four 8-bit signed integers. 139b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG /// Then, each component is converted to a normalized floating-point value to generate the returned two- or four-component vector. 140b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG /// 141b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG /// The conversion for unpacked fixed-point value f to floating point is done as follows: 142b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG /// unpackSnorm4x8: clamp(f / 127.0, -1, +1) 143b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG /// 144b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG /// The first component of the returned vector will be extracted from the least significant bits of the input; 145b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG /// the last component will be extracted from the most significant bits. 146b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG /// 147b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackSnorm4x8.xml">GLSL unpackSnorm4x8 man page</a> 148b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG /// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a> 149b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG GLM_FUNC_DECL vec4 unpackSnorm4x8(uint const & p); 150b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG 151b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG /// Returns a double-precision value obtained by packing the components of v into a 64-bit value. 152b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG /// If an IEEE 754 Inf or NaN is created, it will not signal, and the resulting floating point value is unspecified. 153b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG /// Otherwise, the bit- level representation of v is preserved. 154b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG /// The first vector component specifies the 32 least significant bits; 155b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG /// the second component specifies the 32 most significant bits. 156b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG /// 157b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/packDouble2x32.xml">GLSL packDouble2x32 man page</a> 158b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG /// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a> 159b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG GLM_FUNC_DECL double packDouble2x32(uvec2 const & v); 160b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG 161b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG /// Returns a two-component unsigned integer vector representation of v. 162b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG /// The bit-level representation of v is preserved. 163b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG /// The first component of the vector contains the 32 least significant bits of the double; 164b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG /// the second component consists the 32 most significant bits. 165b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG /// 166b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackDouble2x32.xml">GLSL unpackDouble2x32 man page</a> 167b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG /// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a> 168b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG GLM_FUNC_DECL uvec2 unpackDouble2x32(double const & v); 169b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG 170b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG /// Returns an unsigned integer obtained by converting the components of a two-component floating-point vector 171b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG /// to the 16-bit floating-point representation found in the OpenGL Specification, 172b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG /// and then packing these two 16- bit integers into a 32-bit unsigned integer. 173b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG /// The first vector component specifies the 16 least-significant bits of the result; 174b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG /// the second component specifies the 16 most-significant bits. 175b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG /// 176b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/packHalf2x16.xml">GLSL packHalf2x16 man page</a> 177b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG /// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a> 178b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG GLM_FUNC_DECL uint packHalf2x16(vec2 const & v); 179b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG 180b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG /// Returns a two-component floating-point vector with components obtained by unpacking a 32-bit unsigned integer into a pair of 16-bit values, 181b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG /// interpreting those values as 16-bit floating-point numbers according to the OpenGL Specification, 182b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG /// and converting them to 32-bit floating-point values. 183b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG /// The first component of the vector is obtained from the 16 least-significant bits of v; 184b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG /// the second component is obtained from the 16 most-significant bits of v. 185b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG /// 186b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackHalf2x16.xml">GLSL unpackHalf2x16 man page</a> 187b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG /// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a> 188b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG GLM_FUNC_DECL vec2 unpackHalf2x16(uint const & v); 189b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG 190b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG /// @} 191b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG}//namespace glm 192b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG 193b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG#include "func_packing.inl" 194b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG 195b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG#endif//GLM_CORE_func_packing 196