• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /// @ref gtc_packing
2 /// @file glm/gtc/packing.hpp
3 ///
4 /// @see core (dependence)
5 ///
6 /// @defgroup gtc_packing GLM_GTC_packing
7 /// @ingroup gtc
8 ///
9 /// @brief This extension provides a set of function to convert vertors to packed
10 /// formats.
11 ///
12 /// <glm/gtc/packing.hpp> need to be included to use these features.
13 
14 #pragma once
15 
16 // Dependency:
17 #include "type_precision.hpp"
18 
19 #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED)
20 #	pragma message("GLM: GLM_GTC_packing extension included")
21 #endif
22 
23 namespace glm
24 {
25 	/// @addtogroup gtc_packing
26 	/// @{
27 
28 	/// First, converts the normalized floating-point value v into a 8-bit integer value.
29 	/// Then, the results are packed into the returned 8-bit unsigned integer.
30 	///
31 	/// The conversion for component c of v to fixed point is done as follows:
32 	/// packUnorm1x8:	round(clamp(c, 0, +1) * 255.0)
33 	///
34 	/// @see gtc_packing
35 	/// @see uint16 packUnorm2x8(vec2 const & v)
36 	/// @see uint32 packUnorm4x8(vec4 const & v)
37 	/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/packUnorm4x8.xml">GLSL packUnorm4x8 man page</a>
38 	/// @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>
39 	GLM_FUNC_DECL uint8 packUnorm1x8(float v);
40 
41 	/// Convert a single 8-bit integer to a normalized floating-point value.
42 	///
43 	/// The conversion for unpacked fixed-point value f to floating point is done as follows:
44 	/// unpackUnorm4x8: f / 255.0
45 	///
46 	/// @see gtc_packing
47 	/// @see vec2 unpackUnorm2x8(uint16 p)
48 	/// @see vec4 unpackUnorm4x8(uint32 p)
49 	/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackUnorm4x8.xml">GLSL unpackUnorm4x8 man page</a>
50 	/// @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>
51 	GLM_FUNC_DECL float unpackUnorm1x8(uint8 p);
52 
53 	/// First, converts each component of the normalized floating-point value v into 8-bit integer values.
54 	/// Then, the results are packed into the returned 16-bit unsigned integer.
55 	///
56 	/// The conversion for component c of v to fixed point is done as follows:
57 	/// packUnorm2x8:	round(clamp(c, 0, +1) * 255.0)
58 	///
59 	/// The first component of the vector will be written to the least significant bits of the output;
60 	/// the last component will be written to the most significant bits.
61 	///
62 	/// @see gtc_packing
63 	/// @see uint8 packUnorm1x8(float const & v)
64 	/// @see uint32 packUnorm4x8(vec4 const & v)
65 	/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/packUnorm4x8.xml">GLSL packUnorm4x8 man page</a>
66 	/// @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>
67 	GLM_FUNC_DECL uint16 packUnorm2x8(vec2 const & v);
68 
69 	/// First, unpacks a single 16-bit unsigned integer p into a pair of 8-bit unsigned integers.
70 	/// Then, each component is converted to a normalized floating-point value to generate the returned two-component vector.
71 	///
72 	/// The conversion for unpacked fixed-point value f to floating point is done as follows:
73 	/// unpackUnorm4x8: f / 255.0
74 	///
75 	/// The first component of the returned vector will be extracted from the least significant bits of the input;
76 	/// the last component will be extracted from the most significant bits.
77 	///
78 	/// @see gtc_packing
79 	/// @see float unpackUnorm1x8(uint8 v)
80 	/// @see vec4 unpackUnorm4x8(uint32 p)
81 	/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackUnorm4x8.xml">GLSL unpackUnorm4x8 man page</a>
82 	/// @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>
83 	GLM_FUNC_DECL vec2 unpackUnorm2x8(uint16 p);
84 
85 	/// First, converts the normalized floating-point value v into 8-bit integer value.
86 	/// Then, the results are packed into the returned 8-bit unsigned integer.
87 	///
88 	/// The conversion to fixed point is done as follows:
89 	/// packSnorm1x8:	round(clamp(s, -1, +1) * 127.0)
90 	///
91 	/// @see gtc_packing
92 	/// @see uint16 packSnorm2x8(vec2 const & v)
93 	/// @see uint32 packSnorm4x8(vec4 const & v)
94 	/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/packSnorm4x8.xml">GLSL packSnorm4x8 man page</a>
95 	/// @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>
96 	GLM_FUNC_DECL uint8 packSnorm1x8(float s);
97 
98 	/// First, unpacks a single 8-bit unsigned integer p into a single 8-bit signed integers.
99 	/// Then, the value is converted to a normalized floating-point value to generate the returned scalar.
100 	///
101 	/// The conversion for unpacked fixed-point value f to floating point is done as follows:
102 	/// unpackSnorm1x8: clamp(f / 127.0, -1, +1)
103 	///
104 	/// @see gtc_packing
105 	/// @see vec2 unpackSnorm2x8(uint16 p)
106 	/// @see vec4 unpackSnorm4x8(uint32 p)
107 	/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackSnorm4x8.xml">GLSL unpackSnorm4x8 man page</a>
108 	/// @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>
109 	GLM_FUNC_DECL float unpackSnorm1x8(uint8 p);
110 
111 	/// First, converts each component of the normalized floating-point value v into 8-bit integer values.
112 	/// Then, the results are packed into the returned 16-bit unsigned integer.
113 	///
114 	/// The conversion for component c of v to fixed point is done as follows:
115 	/// packSnorm2x8:	round(clamp(c, -1, +1) * 127.0)
116 	///
117 	/// The first component of the vector will be written to the least significant bits of the output;
118 	/// the last component will be written to the most significant bits.
119 	///
120 	/// @see gtc_packing
121 	/// @see uint8 packSnorm1x8(float const & v)
122 	/// @see uint32 packSnorm4x8(vec4 const & v)
123 	/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/packSnorm4x8.xml">GLSL packSnorm4x8 man page</a>
124 	/// @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>
125 	GLM_FUNC_DECL uint16 packSnorm2x8(vec2 const & v);
126 
127 	/// First, unpacks a single 16-bit unsigned integer p into a pair of 8-bit signed integers.
128 	/// Then, each component is converted to a normalized floating-point value to generate the returned two-component vector.
129 	///
130 	/// The conversion for unpacked fixed-point value f to floating point is done as follows:
131 	/// unpackSnorm2x8: clamp(f / 127.0, -1, +1)
132 	///
133 	/// The first component of the returned vector will be extracted from the least significant bits of the input;
134 	/// the last component will be extracted from the most significant bits.
135 	///
136 	/// @see gtc_packing
137 	/// @see float unpackSnorm1x8(uint8 p)
138 	/// @see vec4 unpackSnorm4x8(uint32 p)
139 	/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackSnorm4x8.xml">GLSL unpackSnorm4x8 man page</a>
140 	/// @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>
141 	GLM_FUNC_DECL vec2 unpackSnorm2x8(uint16 p);
142 
143 	/// First, converts the normalized floating-point value v into a 16-bit integer value.
144 	/// Then, the results are packed into the returned 16-bit unsigned integer.
145 	///
146 	/// The conversion for component c of v to fixed point is done as follows:
147 	/// packUnorm1x16:	round(clamp(c, 0, +1) * 65535.0)
148 	///
149 	/// @see gtc_packing
150 	/// @see uint16 packSnorm1x16(float const & v)
151 	/// @see uint64 packSnorm4x16(vec4 const & v)
152 	/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/packUnorm4x8.xml">GLSL packUnorm4x8 man page</a>
153 	/// @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>
154 	GLM_FUNC_DECL uint16 packUnorm1x16(float v);
155 
156 	/// First, unpacks a single 16-bit unsigned integer p into a of 16-bit unsigned integers.
157 	/// Then, the value is converted to a normalized floating-point value to generate the returned scalar.
158 	///
159 	/// The conversion for unpacked fixed-point value f to floating point is done as follows:
160 	/// unpackUnorm1x16: f / 65535.0
161 	///
162 	/// @see gtc_packing
163 	/// @see vec2 unpackUnorm2x16(uint32 p)
164 	/// @see vec4 unpackUnorm4x16(uint64 p)
165 	/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackUnorm2x16.xml">GLSL unpackUnorm2x16 man page</a>
166 	/// @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>
167 	GLM_FUNC_DECL float unpackUnorm1x16(uint16 p);
168 
169 	/// First, converts each component of the normalized floating-point value v into 16-bit integer values.
170 	/// Then, the results are packed into the returned 64-bit unsigned integer.
171 	///
172 	/// The conversion for component c of v to fixed point is done as follows:
173 	/// packUnorm4x16:	round(clamp(c, 0, +1) * 65535.0)
174 	///
175 	/// The first component of the vector will be written to the least significant bits of the output;
176 	/// the last component will be written to the most significant bits.
177 	///
178 	/// @see gtc_packing
179 	/// @see uint16 packUnorm1x16(float const & v)
180 	/// @see uint32 packUnorm2x16(vec2 const & v)
181 	/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/packUnorm4x8.xml">GLSL packUnorm4x8 man page</a>
182 	/// @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>
183 	GLM_FUNC_DECL uint64 packUnorm4x16(vec4 const & v);
184 
185 	/// First, unpacks a single 64-bit unsigned integer p into four 16-bit unsigned integers.
186 	/// Then, each component is converted to a normalized floating-point value to generate the returned four-component vector.
187 	///
188 	/// The conversion for unpacked fixed-point value f to floating point is done as follows:
189 	/// unpackUnormx4x16: f / 65535.0
190 	///
191 	/// The first component of the returned vector will be extracted from the least significant bits of the input;
192 	/// the last component will be extracted from the most significant bits.
193 	///
194 	/// @see gtc_packing
195 	/// @see float unpackUnorm1x16(uint16 p)
196 	/// @see vec2 unpackUnorm2x16(uint32 p)
197 	/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackUnorm2x16.xml">GLSL unpackUnorm2x16 man page</a>
198 	/// @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>
199 	GLM_FUNC_DECL vec4 unpackUnorm4x16(uint64 p);
200 
201 	/// First, converts the normalized floating-point value v into 16-bit integer value.
202 	/// Then, the results are packed into the returned 16-bit unsigned integer.
203 	///
204 	/// The conversion to fixed point is done as follows:
205 	/// packSnorm1x8:	round(clamp(s, -1, +1) * 32767.0)
206 	///
207 	/// @see gtc_packing
208 	/// @see uint32 packSnorm2x16(vec2 const & v)
209 	/// @see uint64 packSnorm4x16(vec4 const & v)
210 	/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/packSnorm4x8.xml">GLSL packSnorm4x8 man page</a>
211 	/// @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>
212 	GLM_FUNC_DECL uint16 packSnorm1x16(float v);
213 
214 	/// First, unpacks a single 16-bit unsigned integer p into a single 16-bit signed integers.
215 	/// Then, each component is converted to a normalized floating-point value to generate the returned scalar.
216 	///
217 	/// The conversion for unpacked fixed-point value f to floating point is done as follows:
218 	/// unpackSnorm1x16: clamp(f / 32767.0, -1, +1)
219 	///
220 	/// @see gtc_packing
221 	/// @see vec2 unpackSnorm2x16(uint32 p)
222 	/// @see vec4 unpackSnorm4x16(uint64 p)
223 	/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackSnorm1x16.xml">GLSL unpackSnorm4x8 man page</a>
224 	/// @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>
225 	GLM_FUNC_DECL float unpackSnorm1x16(uint16 p);
226 
227 	/// First, converts each component of the normalized floating-point value v into 16-bit integer values.
228 	/// Then, the results are packed into the returned 64-bit unsigned integer.
229 	///
230 	/// The conversion for component c of v to fixed point is done as follows:
231 	/// packSnorm2x8:	round(clamp(c, -1, +1) * 32767.0)
232 	///
233 	/// The first component of the vector will be written to the least significant bits of the output;
234 	/// the last component will be written to the most significant bits.
235 	///
236 	/// @see gtc_packing
237 	/// @see uint16 packSnorm1x16(float const & v)
238 	/// @see uint32 packSnorm2x16(vec2 const & v)
239 	/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/packSnorm4x8.xml">GLSL packSnorm4x8 man page</a>
240 	/// @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>
241 	GLM_FUNC_DECL uint64 packSnorm4x16(vec4 const & v);
242 
243 	/// First, unpacks a single 64-bit unsigned integer p into four 16-bit signed integers.
244 	/// Then, each component is converted to a normalized floating-point value to generate the returned four-component vector.
245 	///
246 	/// The conversion for unpacked fixed-point value f to floating point is done as follows:
247 	/// unpackSnorm4x16: clamp(f / 32767.0, -1, +1)
248 	///
249 	/// The first component of the returned vector will be extracted from the least significant bits of the input;
250 	/// the last component will be extracted from the most significant bits.
251 	///
252 	/// @see gtc_packing
253 	/// @see float unpackSnorm1x16(uint16 p)
254 	/// @see vec2 unpackSnorm2x16(uint32 p)
255 	/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackSnorm2x16.xml">GLSL unpackSnorm4x8 man page</a>
256 	/// @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>
257 	GLM_FUNC_DECL vec4 unpackSnorm4x16(uint64 p);
258 
259 	/// Returns an unsigned integer obtained by converting the components of a floating-point scalar
260 	/// to the 16-bit floating-point representation found in the OpenGL Specification,
261 	/// and then packing this 16-bit value into a 16-bit unsigned integer.
262 	///
263 	/// @see gtc_packing
264 	/// @see uint32 packHalf2x16(vec2 const & v)
265 	/// @see uint64 packHalf4x16(vec4 const & v)
266 	/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/packHalf2x16.xml">GLSL packHalf2x16 man page</a>
267 	/// @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>
268 	GLM_FUNC_DECL uint16 packHalf1x16(float v);
269 
270 	/// Returns a floating-point scalar with components obtained by unpacking a 16-bit unsigned integer into a 16-bit value,
271 	/// interpreted as a 16-bit floating-point number according to the OpenGL Specification,
272 	/// and converting it to 32-bit floating-point values.
273 	///
274 	/// @see gtc_packing
275 	/// @see vec2 unpackHalf2x16(uint32 const & v)
276 	/// @see vec4 unpackHalf4x16(uint64 const & v)
277 	/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackHalf2x16.xml">GLSL unpackHalf2x16 man page</a>
278 	/// @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>
279 	GLM_FUNC_DECL float unpackHalf1x16(uint16 v);
280 
281 	/// Returns an unsigned integer obtained by converting the components of a four-component floating-point vector
282 	/// to the 16-bit floating-point representation found in the OpenGL Specification,
283 	/// and then packing these four 16-bit values into a 64-bit unsigned integer.
284 	/// The first vector component specifies the 16 least-significant bits of the result;
285 	/// the forth component specifies the 16 most-significant bits.
286 	///
287 	/// @see gtc_packing
288 	/// @see uint16 packHalf1x16(float const & v)
289 	/// @see uint32 packHalf2x16(vec2 const & v)
290 	/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/packHalf2x16.xml">GLSL packHalf2x16 man page</a>
291 	/// @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>
292 	GLM_FUNC_DECL uint64 packHalf4x16(vec4 const & v);
293 
294 	/// Returns a four-component floating-point vector with components obtained by unpacking a 64-bit unsigned integer into four 16-bit values,
295 	/// interpreting those values as 16-bit floating-point numbers according to the OpenGL Specification,
296 	/// and converting them to 32-bit floating-point values.
297 	/// The first component of the vector is obtained from the 16 least-significant bits of v;
298 	/// the forth component is obtained from the 16 most-significant bits of v.
299 	///
300 	/// @see gtc_packing
301 	/// @see float unpackHalf1x16(uint16 const & v)
302 	/// @see vec2 unpackHalf2x16(uint32 const & v)
303 	/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackHalf2x16.xml">GLSL unpackHalf2x16 man page</a>
304 	/// @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>
305 	GLM_FUNC_DECL vec4 unpackHalf4x16(uint64 p);
306 
307 	/// Returns an unsigned integer obtained by converting the components of a four-component signed integer vector
308 	/// to the 10-10-10-2-bit signed integer representation found in the OpenGL Specification,
309 	/// and then packing these four values into a 32-bit unsigned integer.
310 	/// The first vector component specifies the 10 least-significant bits of the result;
311 	/// the forth component specifies the 2 most-significant bits.
312 	///
313 	/// @see gtc_packing
314 	/// @see uint32 packI3x10_1x2(uvec4 const & v)
315 	/// @see uint32 packSnorm3x10_1x2(vec4 const & v)
316 	/// @see uint32 packUnorm3x10_1x2(vec4 const & v)
317 	/// @see ivec4 unpackI3x10_1x2(uint32 const & p)
318 	GLM_FUNC_DECL uint32 packI3x10_1x2(ivec4 const & v);
319 
320 	/// Unpacks a single 32-bit unsigned integer p into three 10-bit and one 2-bit signed integers.
321 	///
322 	/// The first component of the returned vector will be extracted from the least significant bits of the input;
323 	/// the last component will be extracted from the most significant bits.
324 	///
325 	/// @see gtc_packing
326 	/// @see uint32 packU3x10_1x2(uvec4 const & v)
327 	/// @see vec4 unpackSnorm3x10_1x2(uint32 const & p);
328 	/// @see uvec4 unpackI3x10_1x2(uint32 const & p);
329 	GLM_FUNC_DECL ivec4 unpackI3x10_1x2(uint32 p);
330 
331 	/// Returns an unsigned integer obtained by converting the components of a four-component unsigned integer vector
332 	/// to the 10-10-10-2-bit unsigned integer representation found in the OpenGL Specification,
333 	/// and then packing these four values into a 32-bit unsigned integer.
334 	/// The first vector component specifies the 10 least-significant bits of the result;
335 	/// the forth component specifies the 2 most-significant bits.
336 	///
337 	/// @see gtc_packing
338 	/// @see uint32 packI3x10_1x2(ivec4 const & v)
339 	/// @see uint32 packSnorm3x10_1x2(vec4 const & v)
340 	/// @see uint32 packUnorm3x10_1x2(vec4 const & v)
341 	/// @see ivec4 unpackU3x10_1x2(uint32 const & p)
342 	GLM_FUNC_DECL uint32 packU3x10_1x2(uvec4 const & v);
343 
344 	/// Unpacks a single 32-bit unsigned integer p into three 10-bit and one 2-bit unsigned integers.
345 	///
346 	/// The first component of the returned vector will be extracted from the least significant bits of the input;
347 	/// the last component will be extracted from the most significant bits.
348 	///
349 	/// @see gtc_packing
350 	/// @see uint32 packU3x10_1x2(uvec4 const & v)
351 	/// @see vec4 unpackSnorm3x10_1x2(uint32 const & p);
352 	/// @see uvec4 unpackI3x10_1x2(uint32 const & p);
353 	GLM_FUNC_DECL uvec4 unpackU3x10_1x2(uint32 p);
354 
355 	/// First, converts the first three components of the normalized floating-point value v into 10-bit signed integer values.
356 	/// Then, converts the forth component of the normalized floating-point value v into 2-bit signed integer values.
357 	/// Then, the results are packed into the returned 32-bit unsigned integer.
358 	///
359 	/// The conversion for component c of v to fixed point is done as follows:
360 	/// packSnorm3x10_1x2(xyz):	round(clamp(c, -1, +1) * 511.0)
361 	/// packSnorm3x10_1x2(w):	round(clamp(c, -1, +1) * 1.0)
362 	///
363 	/// The first vector component specifies the 10 least-significant bits of the result;
364 	/// the forth component specifies the 2 most-significant bits.
365 	///
366 	/// @see gtc_packing
367 	/// @see vec4 unpackSnorm3x10_1x2(uint32 const & p)
368 	/// @see uint32 packUnorm3x10_1x2(vec4 const & v)
369 	/// @see uint32 packU3x10_1x2(uvec4 const & v)
370 	/// @see uint32 packI3x10_1x2(ivec4 const & v)
371 	GLM_FUNC_DECL uint32 packSnorm3x10_1x2(vec4 const & v);
372 
373 	/// First, unpacks a single 32-bit unsigned integer p into four 16-bit signed integers.
374 	/// Then, each component is converted to a normalized floating-point value to generate the returned four-component vector.
375 	///
376 	/// The conversion for unpacked fixed-point value f to floating point is done as follows:
377 	/// unpackSnorm3x10_1x2(xyz): clamp(f / 511.0, -1, +1)
378 	/// unpackSnorm3x10_1x2(w): clamp(f / 511.0, -1, +1)
379 	///
380 	/// The first component of the returned vector will be extracted from the least significant bits of the input;
381 	/// the last component will be extracted from the most significant bits.
382 	///
383 	/// @see gtc_packing
384 	/// @see uint32 packSnorm3x10_1x2(vec4 const & v)
385 	/// @see vec4 unpackUnorm3x10_1x2(uint32 const & p))
386 	/// @see uvec4 unpackI3x10_1x2(uint32 const & p)
387 	/// @see uvec4 unpackU3x10_1x2(uint32 const & p)
388 	GLM_FUNC_DECL vec4 unpackSnorm3x10_1x2(uint32 p);
389 
390 	/// First, converts the first three components of the normalized floating-point value v into 10-bit unsigned integer values.
391 	/// Then, converts the forth component of the normalized floating-point value v into 2-bit signed uninteger values.
392 	/// Then, the results are packed into the returned 32-bit unsigned integer.
393 	///
394 	/// The conversion for component c of v to fixed point is done as follows:
395 	/// packUnorm3x10_1x2(xyz):	round(clamp(c, 0, +1) * 1023.0)
396 	/// packUnorm3x10_1x2(w):	round(clamp(c, 0, +1) * 3.0)
397 	///
398 	/// The first vector component specifies the 10 least-significant bits of the result;
399 	/// the forth component specifies the 2 most-significant bits.
400 	///
401 	/// @see gtc_packing
402 	/// @see vec4 unpackUnorm3x10_1x2(uint32 const & p)
403 	/// @see uint32 packUnorm3x10_1x2(vec4 const & v)
404 	/// @see uint32 packU3x10_1x2(uvec4 const & v)
405 	/// @see uint32 packI3x10_1x2(ivec4 const & v)
406 	GLM_FUNC_DECL uint32 packUnorm3x10_1x2(vec4 const & v);
407 
408 	/// First, unpacks a single 32-bit unsigned integer p into four 16-bit signed integers.
409 	/// Then, each component is converted to a normalized floating-point value to generate the returned four-component vector.
410 	///
411 	/// The conversion for unpacked fixed-point value f to floating point is done as follows:
412 	/// unpackSnorm3x10_1x2(xyz): clamp(f / 1023.0, 0, +1)
413 	/// unpackSnorm3x10_1x2(w): clamp(f / 3.0, 0, +1)
414 	///
415 	/// The first component of the returned vector will be extracted from the least significant bits of the input;
416 	/// the last component will be extracted from the most significant bits.
417 	///
418 	/// @see gtc_packing
419 	/// @see uint32 packSnorm3x10_1x2(vec4 const & v)
420 	/// @see vec4 unpackInorm3x10_1x2(uint32 const & p))
421 	/// @see uvec4 unpackI3x10_1x2(uint32 const & p)
422 	/// @see uvec4 unpackU3x10_1x2(uint32 const & p)
423 	GLM_FUNC_DECL vec4 unpackUnorm3x10_1x2(uint32 p);
424 
425 	/// First, converts the first two components of the normalized floating-point value v into 11-bit signless floating-point values.
426 	/// Then, converts the third component of the normalized floating-point value v into a 10-bit signless floating-point value.
427 	/// Then, the results are packed into the returned 32-bit unsigned integer.
428 	///
429 	/// The first vector component specifies the 11 least-significant bits of the result;
430 	/// the last component specifies the 10 most-significant bits.
431 	///
432 	/// @see gtc_packing
433 	/// @see vec3 unpackF2x11_1x10(uint32 const & p)
434 	GLM_FUNC_DECL uint32 packF2x11_1x10(vec3 const & v);
435 
436 	/// First, unpacks a single 32-bit unsigned integer p into two 11-bit signless floating-point values and one 10-bit signless floating-point value .
437 	/// Then, each component is converted to a normalized floating-point value to generate the returned three-component vector.
438 	///
439 	/// The first component of the returned vector will be extracted from the least significant bits of the input;
440 	/// the last component will be extracted from the most significant bits.
441 	///
442 	/// @see gtc_packing
443 	/// @see uint32 packF2x11_1x10(vec3 const & v)
444 	GLM_FUNC_DECL vec3 unpackF2x11_1x10(uint32 p);
445 
446 
447 	/// First, converts the first two components of the normalized floating-point value v into 11-bit signless floating-point values.
448 	/// Then, converts the third component of the normalized floating-point value v into a 10-bit signless floating-point value.
449 	/// Then, the results are packed into the returned 32-bit unsigned integer.
450 	///
451 	/// The first vector component specifies the 11 least-significant bits of the result;
452 	/// the last component specifies the 10 most-significant bits.
453 	///
454 	/// @see gtc_packing
455 	/// @see vec3 unpackF3x9_E1x5(uint32 const & p)
456 	GLM_FUNC_DECL uint32 packF3x9_E1x5(vec3 const & v);
457 
458 	/// First, unpacks a single 32-bit unsigned integer p into two 11-bit signless floating-point values and one 10-bit signless floating-point value .
459 	/// Then, each component is converted to a normalized floating-point value to generate the returned three-component vector.
460 	///
461 	/// The first component of the returned vector will be extracted from the least significant bits of the input;
462 	/// the last component will be extracted from the most significant bits.
463 	///
464 	/// @see gtc_packing
465 	/// @see uint32 packF3x9_E1x5(vec3 const & v)
466 	GLM_FUNC_DECL vec3 unpackF3x9_E1x5(uint32 p);
467 
468 	/// Returns an unsigned integer vector obtained by converting the components of a floating-point vector
469 	/// to the 16-bit floating-point representation found in the OpenGL Specification.
470 	/// The first vector component specifies the 16 least-significant bits of the result;
471 	/// the forth component specifies the 16 most-significant bits.
472 	///
473 	/// @see gtc_packing
474 	/// @see vecType<float, P> unpackHalf(vecType<uint16, P> const & p)
475 	/// @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>
476 	template <precision P, template <typename, precision> class vecType>
477 	GLM_FUNC_DECL vecType<uint16, P> packHalf(vecType<float, P> const & v);
478 
479 	/// Returns a floating-point vector with components obtained by reinterpreting an integer vector as 16-bit floating-point numbers and converting them to 32-bit floating-point values.
480 	/// The first component of the vector is obtained from the 16 least-significant bits of v;
481 	/// the forth component is obtained from the 16 most-significant bits of v.
482 	///
483 	/// @see gtc_packing
484 	/// @see vecType<uint16, P> packHalf(vecType<float, P> const & v)
485 	/// @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>
486 	template <precision P, template <typename, precision> class vecType>
487 	GLM_FUNC_DECL vecType<float, P> unpackHalf(vecType<uint16, P> const & p);
488 
489 	/// Convert each component of the normalized floating-point vector into unsigned integer values.
490 	///
491 	/// @see gtc_packing
492 	/// @see vecType<floatType, P> unpackUnorm(vecType<intType, P> const & p);
493 	template <typename uintType, typename floatType, precision P, template <typename, precision> class vecType>
494 	GLM_FUNC_DECL vecType<uintType, P> packUnorm(vecType<floatType, P> const & v);
495 
496 	/// Convert each unsigned integer components of a vector to normalized floating-point values.
497 	///
498 	/// @see gtc_packing
499 	/// @see vecType<intType, P> packUnorm(vecType<floatType, P> const & v)
500 	template <typename uintType, typename floatType, precision P, template <typename, precision> class vecType>
501 	GLM_FUNC_DECL vecType<floatType, P> unpackUnorm(vecType<uintType, P> const & v);
502 
503 	/// Convert each component of the normalized floating-point vector into signed integer values.
504 	///
505 	/// @see gtc_packing
506 	/// @see vecType<floatType, P> unpackSnorm(vecType<intType, P> const & p);
507 	template <typename intType, typename floatType, precision P, template <typename, precision> class vecType>
508 	GLM_FUNC_DECL vecType<intType, P> packSnorm(vecType<floatType, P> const & v);
509 
510 	/// Convert each signed integer components of a vector to normalized floating-point values.
511 	///
512 	/// @see gtc_packing
513 	/// @see vecType<intType, P> packSnorm(vecType<floatType, P> const & v)
514 	template <typename intType, typename floatType, precision P, template <typename, precision> class vecType>
515 	GLM_FUNC_DECL vecType<floatType, P> unpackSnorm(vecType<intType, P> const & v);
516 
517 	/// Convert each component of the normalized floating-point vector into unsigned integer values.
518 	///
519 	/// @see gtc_packing
520 	/// @see vec2 unpackUnorm2x4(uint8 p)
521 	GLM_FUNC_DECL uint8 packUnorm2x4(vec2 const & v);
522 
523 	/// Convert each unsigned integer components of a vector to normalized floating-point values.
524 	///
525 	/// @see gtc_packing
526 	/// @see uint8 packUnorm2x4(vec2 const & v)
527 	GLM_FUNC_DECL vec2 unpackUnorm2x4(uint8 p);
528 
529 	/// Convert each component of the normalized floating-point vector into unsigned integer values.
530 	///
531 	/// @see gtc_packing
532 	/// @see vec4 unpackUnorm4x4(uint16 p)
533 	GLM_FUNC_DECL uint16 packUnorm4x4(vec4 const & v);
534 
535 	/// Convert each unsigned integer components of a vector to normalized floating-point values.
536 	///
537 	/// @see gtc_packing
538 	/// @see uint16 packUnorm4x4(vec4 const & v)
539 	GLM_FUNC_DECL vec4 unpackUnorm4x4(uint16 p);
540 
541 	/// Convert each component of the normalized floating-point vector into unsigned integer values.
542 	///
543 	/// @see gtc_packing
544 	/// @see vec3 unpackUnorm1x5_1x6_1x5(uint16 p)
545 	GLM_FUNC_DECL uint16 packUnorm1x5_1x6_1x5(vec3 const & v);
546 
547 	/// Convert each unsigned integer components of a vector to normalized floating-point values.
548 	///
549 	/// @see gtc_packing
550 	/// @see uint16 packUnorm1x5_1x6_1x5(vec3 const & v)
551 	GLM_FUNC_DECL vec3 unpackUnorm1x5_1x6_1x5(uint16 p);
552 
553 	/// Convert each component of the normalized floating-point vector into unsigned integer values.
554 	///
555 	/// @see gtc_packing
556 	/// @see vec4 unpackUnorm3x5_1x1(uint16 p)
557 	GLM_FUNC_DECL uint16 packUnorm3x5_1x1(vec4 const & v);
558 
559 	/// Convert each unsigned integer components of a vector to normalized floating-point values.
560 	///
561 	/// @see gtc_packing
562 	/// @see uint16 packUnorm3x5_1x1(vec4 const & v)
563 	GLM_FUNC_DECL vec4 unpackUnorm3x5_1x1(uint16 p);
564 
565 	/// Convert each component of the normalized floating-point vector into unsigned integer values.
566 	///
567 	/// @see gtc_packing
568 	/// @see vec3 unpackUnorm2x3_1x2(uint8 p)
569 	GLM_FUNC_DECL uint8 packUnorm2x3_1x2(vec3 const & v);
570 
571 	/// Convert each unsigned integer components of a vector to normalized floating-point values.
572 	///
573 	/// @see gtc_packing
574 	/// @see uint8 packUnorm2x3_1x2(vec3 const & v)
575 	GLM_FUNC_DECL vec3 unpackUnorm2x3_1x2(uint8 p);
576 	/// @}
577 }// namespace glm
578 
579 #include "packing.inl"
580