1
///////////////////////////////////////////////////////////////////////////////////
2
/// OpenGL Mathematics (glm.g-truc.net)
4
/// Copyright (c) 2005 - 2012 G-Truc Creation (www.g-truc.net)
5
/// Permission is hereby granted, free of charge, to any person obtaining a copy
6
/// of this software and associated documentation files (the "Software"), to deal
7
/// in the Software without restriction, including without limitation the rights
8
/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
/// copies of the Software, and to permit persons to whom the Software is
10
/// furnished to do so, subject to the following conditions:
12
/// The above copyright notice and this permission notice shall be included in
13
/// all copies or substantial portions of the Software.
15
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
/// @ref gtc_type_precision
24
/// @file glm/gtc/type_precision.hpp
25
/// @date 2009-06-04 / 2011-12-07
26
/// @author Christophe Riccio
28
/// @see core (dependence)
29
/// @see gtc_half_float (dependence)
30
/// @see gtc_quaternion (dependence)
32
/// @defgroup gtc_type_precision GLM_GTC_type_precision: Vector and matrix types with defined precisions
35
/// @brief Defines specific C++-based precision types.
37
/// @ref core_precision defines types based on GLSL's precision qualifiers. This
38
/// extension defines types based on explicitly-sized C++ data types.
40
/// <glm/gtc/type_precision.hpp> need to be included to use these functionalities.
41
///////////////////////////////////////////////////////////////////////////////////
43
#ifndef GLM_GTC_type_precision
44
#define GLM_GTC_type_precision GLM_VERSION
48
#include "../gtc/half_float.hpp"
49
#include "../gtc/quaternion.hpp"
51
#if(defined(GLM_MESSAGES) && !defined(glm_ext))
52
# pragma message("GLM: GLM_GTC_type_precision extension included")
57
///////////////////////////
58
// Signed int vector types
60
/// @addtogroup gtc_type_precision
63
/// 8 bit signed integer type.
64
/// @see gtc_type_precision
65
typedef detail::int8 int8;
67
/// 16 bit signed integer type.
68
/// @see gtc_type_precision
69
typedef detail::int16 int16;
71
/// 32 bit signed integer type.
72
/// @see gtc_type_precision
73
typedef detail::int32 int32;
75
/// 64 bit signed integer type.
76
/// @see gtc_type_precision
77
typedef detail::int64 int64;
80
/// 8 bit signed integer type.
81
/// @see gtc_type_precision
82
typedef detail::int8 int8_t;
84
/// 16 bit signed integer type.
85
/// @see gtc_type_precision
86
typedef detail::int16 int16_t;
88
/// 32 bit signed integer type.
89
/// @see gtc_type_precision
90
typedef detail::int32 int32_t;
92
/// 64 bit signed integer type.
93
/// @see gtc_type_precision
94
typedef detail::int64 int64_t;
97
/// 8 bit signed integer type.
98
/// @see gtc_type_precision
99
typedef detail::int8 i8;
101
/// 16 bit signed integer type.
102
/// @see gtc_type_precision
103
typedef detail::int16 i16;
105
/// 32 bit signed integer type.
106
/// @see gtc_type_precision
107
typedef detail::int32 i32;
109
/// 64 bit signed integer type.
110
/// @see gtc_type_precision
111
typedef detail::int64 i64;
114
/// 8 bit signed integer scalar type.
115
/// @see gtc_type_precision
116
typedef detail::tvec1<i8> i8vec1;
118
/// 8 bit signed integer vector of 2 components type.
119
/// @see gtc_type_precision
120
typedef detail::tvec2<i8> i8vec2;
122
/// 8 bit signed integer vector of 3 components type.
123
/// @see gtc_type_precision
124
typedef detail::tvec3<i8> i8vec3;
126
/// 8 bit signed integer vector of 4 components type.
127
/// @see gtc_type_precision
128
typedef detail::tvec4<i8> i8vec4;
131
/// 16 bit signed integer scalar type.
132
/// @see gtc_type_precision
133
typedef detail::tvec1<i16> i16vec1;
135
/// 16 bit signed integer vector of 2 components type.
136
/// @see gtc_type_precision
137
typedef detail::tvec2<i16> i16vec2;
139
/// 16 bit signed integer vector of 3 components type.
140
/// @see gtc_type_precision
141
typedef detail::tvec3<i16> i16vec3;
143
/// 16 bit signed integer vector of 4 components type.
144
/// @see gtc_type_precision
145
typedef detail::tvec4<i16> i16vec4;
148
/// 32 bit signed integer scalar type.
149
/// @see gtc_type_precision
150
typedef detail::tvec1<i32> i32vec1;
152
/// 32 bit signed integer vector of 2 components type.
153
/// @see gtc_type_precision
154
typedef detail::tvec2<i32> i32vec2;
156
/// 32 bit signed integer vector of 3 components type.
157
/// @see gtc_type_precision
158
typedef detail::tvec3<i32> i32vec3;
160
/// 32 bit signed integer vector of 4 components type.
161
/// @see gtc_type_precision
162
typedef detail::tvec4<i32> i32vec4;
165
/// 64 bit signed integer scalar type.
166
/// @see gtc_type_precision
167
typedef detail::tvec1<i64> i64vec1;
169
/// 64 bit signed integer vector of 2 components type.
170
/// @see gtc_type_precision
171
typedef detail::tvec2<i64> i64vec2;
173
/// 64 bit signed integer vector of 3 components type.
174
/// @see gtc_type_precision
175
typedef detail::tvec3<i64> i64vec3;
177
/// 64 bit signed integer vector of 4 components type.
178
/// @see gtc_type_precision
179
typedef detail::tvec4<i64> i64vec4;
182
/////////////////////////////
183
// Unsigned int vector types
185
/// 8 bit unsigned integer type.
186
/// @see gtc_type_precision
187
typedef detail::uint8 uint8;
189
/// 16 bit unsigned integer type.
190
/// @see gtc_type_precision
191
typedef detail::uint16 uint16;
193
/// 32 bit unsigned integer type.
194
/// @see gtc_type_precision
195
typedef detail::uint32 uint32;
197
/// 64 bit unsigned integer type.
198
/// @see gtc_type_precision
199
typedef detail::uint64 uint64;
202
/// 8 bit unsigned integer type.
203
/// @see gtc_type_precision
204
typedef detail::uint8 uint8_t;
206
/// 16 bit unsigned integer type.
207
/// @see gtc_type_precision
208
typedef detail::uint16 uint16_t;
210
/// 32 bit unsigned integer type.
211
/// @see gtc_type_precision
212
typedef detail::uint32 uint32_t;
214
/// 64 bit unsigned integer type.
215
/// @see gtc_type_precision
216
typedef detail::uint64 uint64_t;
219
/// 8 bit unsigned integer type.
220
/// @see gtc_type_precision
221
typedef detail::uint8 u8;
223
/// 16 bit unsigned integer type.
224
/// @see gtc_type_precision
225
typedef detail::uint16 u16;
227
/// 32 bit unsigned integer type.
228
/// @see gtc_type_precision
229
typedef detail::uint32 u32;
231
/// 64 bit unsigned integer type.
232
/// @see gtc_type_precision
233
typedef detail::uint64 u64;
236
/// 8 bit unsigned integer scalar type.
237
/// @see gtc_type_precision
238
typedef detail::tvec1<u8> u8vec1;
240
/// 8 bit unsigned integer vector of 2 components type.
241
/// @see gtc_type_precision
242
typedef detail::tvec2<u8> u8vec2;
244
/// 8 bit unsigned integer vector of 3 components type.
245
/// @see gtc_type_precision
246
typedef detail::tvec3<u8> u8vec3;
248
/// 8 bit unsigned integer vector of 4 components type.
249
/// @see gtc_type_precision
250
typedef detail::tvec4<u8> u8vec4;
253
/// 16 bit unsigned integer scalar type.
254
/// @see gtc_type_precision
255
typedef detail::tvec1<u16> u16vec1;
257
/// 16 bit unsigned integer vector of 2 components type.
258
/// @see gtc_type_precision
259
typedef detail::tvec2<u16> u16vec2;
261
/// 16 bit unsigned integer vector of 3 components type.
262
/// @see gtc_type_precision
263
typedef detail::tvec3<u16> u16vec3;
265
/// 16 bit unsigned integer vector of 4 components type.
266
/// @see gtc_type_precision
267
typedef detail::tvec4<u16> u16vec4;
270
/// 32 bit unsigned integer scalar type.
271
/// @see gtc_type_precision
272
typedef detail::tvec1<u32> u32vec1;
274
/// 32 bit unsigned integer vector of 2 components type.
275
/// @see gtc_type_precision
276
typedef detail::tvec2<u32> u32vec2;
278
/// 32 bit unsigned integer vector of 3 components type.
279
/// @see gtc_type_precision
280
typedef detail::tvec3<u32> u32vec3;
282
/// 32 bit unsigned integer vector of 4 components type.
283
/// @see gtc_type_precision
284
typedef detail::tvec4<u32> u32vec4;
287
/// 64 bit unsigned integer scalar type.
288
/// @see gtc_type_precision
289
typedef detail::tvec1<u64> u64vec1;
291
/// 64 bit unsigned integer vector of 2 components type.
292
/// @see gtc_type_precision
293
typedef detail::tvec2<u64> u64vec2;
295
/// 64 bit unsigned integer vector of 3 components type.
296
/// @see gtc_type_precision
297
typedef detail::tvec3<u64> u64vec3;
299
/// 64 bit unsigned integer vector of 4 components type.
300
/// @see gtc_type_precision
301
typedef detail::tvec4<u64> u64vec4;
304
//////////////////////
305
// Float vector types
307
/// 16 bit half-precision floating-point scalar.
308
/// @see gtc_type_precision
309
typedef detail::float16 float16;
311
/// 32 bit single-precision floating-point scalar.
312
/// @see gtc_type_precision
313
typedef detail::float32 float32;
315
/// 64 bit double-precision floating-point scalar.
316
/// @see gtc_type_precision
317
typedef detail::float64 float64;
320
/// 16 bit half-precision floating-point scalar.
321
/// @see gtc_type_precision
322
typedef detail::float16 float16_t;
324
/// 32 bit single-precision floating-point scalar.
325
/// @see gtc_type_precision
326
typedef detail::float32 float32_t;
328
/// 64 bit double-precision floating-point scalar.
329
/// @see gtc_type_precision
330
typedef detail::float64 float64_t;
333
/// 16 bit half-precision floating-point scalar.
334
/// @see gtc_type_precision
337
/// 32 bit single-precision floating-point scalar.
338
/// @see gtc_type_precision
341
/// 64 bit double-precision floating-point scalar.
342
/// @see gtc_type_precision
346
/// Single-precision floating-point vector of 1 component.
347
/// @see gtc_type_precision
348
typedef detail::tvec1<float> fvec1;
350
/// Single-precision floating-point vector of 2 components.
351
/// @see gtc_type_precision
352
typedef detail::tvec2<float> fvec2;
354
/// Single-precision floating-point vector of 3 components.
355
/// @see gtc_type_precision
356
typedef detail::tvec3<float> fvec3;
358
/// Single-precision floating-point vector of 4 components.
359
/// @see gtc_type_precision
360
typedef detail::tvec4<float> fvec4;
363
/// Half-precision floating-point vector of 1 component.
364
/// @see gtc_type_precision
365
typedef detail::tvec1<f16> f16vec1;
367
/// Half-precision floating-point vector of 2 components.
368
/// @see gtc_type_precision
369
typedef detail::tvec2<f16> f16vec2;
371
/// Half-precision floating-point vector of 3 components.
372
/// @see gtc_type_precision
373
typedef detail::tvec3<f16> f16vec3;
375
/// Half-precision floating-point vector of 4 components.
376
/// @see gtc_type_precision
377
typedef detail::tvec4<f16> f16vec4;
380
/// Single-precision floating-point vector of 1 component.
381
/// @see gtc_type_precision
382
typedef detail::tvec1<f32> f32vec1;
384
/// Single-precision floating-point vector of 2 components.
385
/// @see gtc_type_precision
386
typedef detail::tvec2<f32> f32vec2;
388
/// Single-precision floating-point vector of 3 components.
389
/// @see gtc_type_precision
390
typedef detail::tvec3<f32> f32vec3;
392
/// Single-precision floating-point vector of 4 components.
393
/// @see gtc_type_precision
394
typedef detail::tvec4<f32> f32vec4;
397
/// Double-precision floating-point vector of 1 component.
398
/// @see gtc_type_precision
399
typedef detail::tvec1<f64> f64vec1;
401
/// Double-precision floating-point vector of 2 components.
402
/// @see gtc_type_precision
403
typedef detail::tvec2<f64> f64vec2;
405
/// Double-precision floating-point vector of 3 components.
406
/// @see gtc_type_precision
407
typedef detail::tvec3<f64> f64vec3;
409
/// Double-precision floating-point vector of 4 components.
410
/// @see gtc_type_precision
411
typedef detail::tvec4<f64> f64vec4;
414
//////////////////////
415
// Float matrix types
417
/// Single-precision floating-point 1x1 matrix.
418
/// @see gtc_type_precision
419
//typedef detail::tmat1x1<f32> fmat1;
421
/// Single-precision floating-point 2x2 matrix.
422
/// @see gtc_type_precision
423
typedef detail::tmat2x2<f32> fmat2;
425
/// Single-precision floating-point 3x3 matrix.
426
/// @see gtc_type_precision
427
typedef detail::tmat3x3<f32> fmat3;
429
/// Single-precision floating-point 4x4 matrix.
430
/// @see gtc_type_precision
431
typedef detail::tmat4x4<f32> fmat4;
434
/// Single-precision floating-point 1x1 matrix.
435
/// @see gtc_type_precision
436
//typedef f32 fmat1x1;
438
/// Single-precision floating-point 2x2 matrix.
439
/// @see gtc_type_precision
440
typedef detail::tmat2x2<f32> fmat2x2;
442
/// Single-precision floating-point 2x3 matrix.
443
/// @see gtc_type_precision
444
typedef detail::tmat2x3<f32> fmat2x3;
446
/// Single-precision floating-point 2x4 matrix.
447
/// @see gtc_type_precision
448
typedef detail::tmat2x4<f32> fmat2x4;
450
/// Single-precision floating-point 3x2 matrix.
451
/// @see gtc_type_precision
452
typedef detail::tmat3x2<f32> fmat3x2;
454
/// Single-precision floating-point 3x3 matrix.
455
/// @see gtc_type_precision
456
typedef detail::tmat3x3<f32> fmat3x3;
458
/// Single-precision floating-point 3x4 matrix.
459
/// @see gtc_type_precision
460
typedef detail::tmat3x4<f32> fmat3x4;
462
/// Single-precision floating-point 4x2 matrix.
463
/// @see gtc_type_precision
464
typedef detail::tmat4x2<f32> fmat4x2;
466
/// Single-precision floating-point 4x3 matrix.
467
/// @see gtc_type_precision
468
typedef detail::tmat4x3<f32> fmat4x3;
470
/// Single-precision floating-point 4x4 matrix.
471
/// @see gtc_type_precision
472
typedef detail::tmat4x4<f32> fmat4x4;
475
/// Half-precision floating-point 1x1 matrix.
476
/// @see gtc_type_precision
477
//typedef detail::tmat1x1<f16> f16mat1;
479
/// Half-precision floating-point 2x2 matrix.
480
/// @see gtc_type_precision
481
typedef detail::tmat2x2<f16> f16mat2;
483
/// Half-precision floating-point 3x3 matrix.
484
/// @see gtc_type_precision
485
typedef detail::tmat3x3<f16> f16mat3;
487
/// Half-precision floating-point 4x4 matrix.
488
/// @see gtc_type_precision
489
typedef detail::tmat4x4<f16> f16mat4;
492
/// Half-precision floating-point 1x1 matrix.
493
/// @see gtc_type_precision
494
//typedef f16 f16mat1x1;
496
/// Half-precision floating-point 2x2 matrix.
497
/// @see gtc_type_precision
498
typedef detail::tmat2x2<f16> f16mat2x2;
500
/// Half-precision floating-point 2x3 matrix.
501
/// @see gtc_type_precision
502
typedef detail::tmat2x3<f16> f16mat2x3;
504
/// Half-precision floating-point 2x4 matrix.
505
/// @see gtc_type_precision
506
typedef detail::tmat2x4<f16> f16mat2x4;
508
/// Half-precision floating-point 3x2 matrix.
509
/// @see gtc_type_precision
510
typedef detail::tmat3x2<f16> f16mat3x2;
512
/// Half-precision floating-point 3x3 matrix.
513
/// @see gtc_type_precision
514
typedef detail::tmat3x3<f16> f16mat3x3;
516
/// Half-precision floating-point 3x4 matrix.
517
/// @see gtc_type_precision
518
typedef detail::tmat3x4<f16> f16mat3x4;
520
/// Half-precision floating-point 4x2 matrix.
521
/// @see gtc_type_precision
522
typedef detail::tmat4x2<f16> f16mat4x2;
524
/// Half-precision floating-point 4x3 matrix.
525
/// @see gtc_type_precision
526
typedef detail::tmat4x3<f16> f16mat4x3;
528
/// Half-precision floating-point 4x4 matrix.
529
/// @see gtc_type_precision
530
typedef detail::tmat4x4<f16> f16mat4x4;
533
/// Single-precision floating-point 1x1 matrix.
534
/// @see gtc_type_precision
535
//typedef detail::tmat1x1<f32> f32mat1;
537
/// Single-precision floating-point 2x2 matrix.
538
/// @see gtc_type_precision
539
typedef detail::tmat2x2<f32> f32mat2;
541
/// Single-precision floating-point 3x3 matrix.
542
/// @see gtc_type_precision
543
typedef detail::tmat3x3<f32> f32mat3;
545
/// Single-precision floating-point 4x4 matrix.
546
/// @see gtc_type_precision
547
typedef detail::tmat4x4<f32> f32mat4;
550
/// Single-precision floating-point 1x1 matrix.
551
/// @see gtc_type_precision
552
//typedef f32 f32mat1x1;
554
/// Single-precision floating-point 2x2 matrix.
555
/// @see gtc_type_precision
556
typedef detail::tmat2x2<f32> f32mat2x2;
558
/// Single-precision floating-point 2x3 matrix.
559
/// @see gtc_type_precision
560
typedef detail::tmat2x3<f32> f32mat2x3;
562
/// Single-precision floating-point 2x4 matrix.
563
/// @see gtc_type_precision
564
typedef detail::tmat2x4<f32> f32mat2x4;
566
/// Single-precision floating-point 3x2 matrix.
567
/// @see gtc_type_precision
568
typedef detail::tmat3x2<f32> f32mat3x2;
570
/// Single-precision floating-point 3x3 matrix.
571
/// @see gtc_type_precision
572
typedef detail::tmat3x3<f32> f32mat3x3;
574
/// Single-precision floating-point 3x4 matrix.
575
/// @see gtc_type_precision
576
typedef detail::tmat3x4<f32> f32mat3x4;
578
/// Single-precision floating-point 4x2 matrix.
579
/// @see gtc_type_precision
580
typedef detail::tmat4x2<f32> f32mat4x2;
582
/// Single-precision floating-point 4x3 matrix.
583
/// @see gtc_type_precision
584
typedef detail::tmat4x3<f32> f32mat4x3;
586
/// Single-precision floating-point 4x4 matrix.
587
/// @see gtc_type_precision
588
typedef detail::tmat4x4<f32> f32mat4x4;
591
/// Double-precision floating-point 1x1 matrix.
592
/// @see gtc_type_precision
593
//typedef detail::tmat1x1<f64> f64mat1;
595
/// Double-precision floating-point 2x2 matrix.
596
/// @see gtc_type_precision
597
typedef detail::tmat2x2<f64> f64mat2;
599
/// Double-precision floating-point 3x3 matrix.
600
/// @see gtc_type_precision
601
typedef detail::tmat3x3<f64> f64mat3;
603
/// Double-precision floating-point 4x4 matrix.
604
/// @see gtc_type_precision
605
typedef detail::tmat4x4<f64> f64mat4;
608
/// Double-precision floating-point 1x1 matrix.
609
/// @see gtc_type_precision
610
//typedef f64 f64mat1x1;
612
/// Double-precision floating-point 2x2 matrix.
613
/// @see gtc_type_precision
614
typedef detail::tmat2x2<f64> f64mat2x2;
616
/// Double-precision floating-point 2x3 matrix.
617
/// @see gtc_type_precision
618
typedef detail::tmat2x3<f64> f64mat2x3;
620
/// Double-precision floating-point 2x4 matrix.
621
/// @see gtc_type_precision
622
typedef detail::tmat2x4<f64> f64mat2x4;
624
/// Double-precision floating-point 3x2 matrix.
625
/// @see gtc_type_precision
626
typedef detail::tmat3x2<f64> f64mat3x2;
628
/// Double-precision floating-point 3x3 matrix.
629
/// @see gtc_type_precision
630
typedef detail::tmat3x3<f64> f64mat3x3;
632
/// Double-precision floating-point 3x4 matrix.
633
/// @see gtc_type_precision
634
typedef detail::tmat3x4<f64> f64mat3x4;
636
/// Double-precision floating-point 4x2 matrix.
637
/// @see gtc_type_precision
638
typedef detail::tmat4x2<f64> f64mat4x2;
640
/// Double-precision floating-point 4x3 matrix.
641
/// @see gtc_type_precision
642
typedef detail::tmat4x3<f64> f64mat4x3;
644
/// Double-precision floating-point 4x4 matrix.
645
/// @see gtc_type_precision
646
typedef detail::tmat4x4<f64> f64mat4x4;
649
//////////////////////////
652
/// Half-precision floating-point quaternion.
653
/// @see gtc_type_precision
654
typedef detail::tquat<f16> f16quat;
656
/// Single-precision floating-point quaternion.
657
/// @see gtc_type_precision
658
typedef detail::tquat<f32> f32quat;
660
/// Double-precision floating-point quaternion.
661
/// @see gtc_type_precision
662
typedef detail::tquat<f64> f64quat;
667
#include "type_precision.inl"
669
#endif//GLM_GTC_type_precision