OpenWalnut
1.3.1
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
src
core
graphicsEngine
WGETypeTraits.h
1
//---------------------------------------------------------------------------
2
//
3
// Project: OpenWalnut ( http://www.openwalnut.org )
4
//
5
// Copyright 2009 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS
6
// For more information see http://www.openwalnut.org/copying
7
//
8
// This file is part of OpenWalnut.
9
//
10
// OpenWalnut is free software: you can redistribute it and/or modify
11
// it under the terms of the GNU Lesser General Public License as published by
12
// the Free Software Foundation, either version 3 of the License, or
13
// (at your option) any later version.
14
//
15
// OpenWalnut is distributed in the hope that it will be useful,
16
// but WITHOUT ANY WARRANTY; without even the implied warranty of
17
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
// GNU Lesser General Public License for more details.
19
//
20
// You should have received a copy of the GNU Lesser General Public License
21
// along with OpenWalnut. If not, see <http://www.gnu.org/licenses/>.
22
//
23
//---------------------------------------------------------------------------
24
25
#ifndef WGETYPETRAITS_H
26
#define WGETYPETRAITS_H
27
28
#include <stdint.h>
29
30
#include <osg/Image>
31
32
33
34
namespace
wge
35
{
36
/**
37
* Class helping to adapt types specified as template parameter into the best matching OpenGL type.
38
*/
39
template
<
typename
T >
40
class
GLType
41
{
42
public
:
43
/**
44
* The best matching OpenGL type for the specified template parameter.
45
*/
46
typedef
T
Type
;
47
48
/**
49
* The enum type of OpenGL
50
*/
51
static
const
GLenum
TypeEnum
= GL_BYTE;
52
};
53
54
/**
55
* Class helping to adapt types specified as template parameter into the best matching OpenGL type.
56
*/
57
template
<>
58
class
GLType
< double >
59
{
60
public
:
61
/**
62
* The best matching OpenGL type for the specified template parameter.
63
*/
64
typedef
float
Type
;
65
66
/**
67
* The enum type of OpenGL
68
*/
69
static
const
GLenum
TypeEnum
= GL_FLOAT;
70
71
/**
72
* The value for full intensity.
73
*
74
* \return the full intensity value
75
*/
76
static
Type
FullIntensity
(){
return
1.0; }
// NOLINT
77
};
78
79
80
/**
81
* Class helping to adapt types specified as template parameter into the best matching OpenGL type.
82
*/
83
template
<>
84
class
GLType
< long double >
85
{
86
public
:
87
/**
88
* The best matching OpenGL type for the specified template parameter.
89
*/
90
typedef
float
Type
;
91
92
/**
93
* The enum type of OpenGL
94
*/
95
static
const
GLenum
TypeEnum
= GL_FLOAT;
96
97
/**
98
* The value for full intensity.
99
*
100
* \return the full intensity value
101
*/
102
static
Type
FullIntensity
(){
return
1.0; }
// NOLINT
103
};
104
105
/**
106
* Class helping to adapt types specified as template parameter into the best matching OpenGL type.
107
*/
108
template
<>
109
class
GLType
< float >
110
{
111
public
:
112
/**
113
* The best matching OpenGL type for the specified template parameter.
114
*/
115
typedef
float
Type
;
116
117
/**
118
* The enum type of OpenGL
119
*/
120
static
const
GLenum
TypeEnum
= GL_FLOAT;
121
122
/**
123
* The value for full intensity.
124
*
125
* \return the full intensity value
126
*/
127
static
Type
FullIntensity
(){
return
1.0; }
// NOLINT
128
};
129
130
/**
131
* Class helping to adapt types specified as template parameter into the best matching OpenGL type.
132
*/
133
template
<>
134
class
GLType
< int8_t >
135
{
136
public
:
137
/**
138
* The best matching OpenGL type for the specified template parameter.
139
*/
140
typedef
int8_t
Type
;
141
142
/**
143
* The enum type of OpenGL
144
*/
145
static
const
GLenum
TypeEnum
= GL_BYTE;
146
147
/**
148
* The value for full intensity.
149
*
150
* \return the full intensity value
151
*/
152
static
Type
FullIntensity
(){
return
127; }
// NOLINT
153
};
154
155
/**
156
* Class helping to adapt types specified as template parameter into the best matching OpenGL type.
157
*/
158
template
<>
159
class
GLType
< uint8_t >
160
{
161
public
:
162
/**
163
* The best matching OpenGL type for the specified template parameter.
164
*/
165
typedef
uint8_t
Type
;
166
167
/**
168
* The enum type of OpenGL
169
*/
170
static
const
GLenum
TypeEnum
= GL_UNSIGNED_BYTE;
171
172
/**
173
* The value for full intensity.
174
*
175
* \return the full intensity value
176
*/
177
static
Type
FullIntensity
(){
return
255; }
// NOLINT
178
};
179
180
/**
181
* Class helping to adapt types specified as template parameter into the best matching OpenGL type.
182
*
183
* \note integral types get downscaled to float. This is done for easiness but might be better if the real type is used instead.
184
*/
185
template
<>
186
class
GLType
< int16_t >
187
{
188
public
:
189
/**
190
* The best matching OpenGL type for the specified template parameter.
191
*/
192
typedef
float
Type
;
193
194
/**
195
* The enum type of OpenGL
196
*/
197
static
const
GLenum
TypeEnum
= GL_FLOAT;
198
199
/**
200
* The value for full intensity.
201
*
202
* \return the full intensity value
203
*/
204
static
Type
FullIntensity
(){
return
1.0; }
// NOLINT
205
};
206
207
/**
208
* Class helping to adapt types specified as template parameter into the best matching OpenGL type.
209
*
210
* \note integral types get downscaled to float. This is done for easiness but might be better if the real type is used instead.
211
*/
212
template
<>
213
class
GLType
< uint16_t >
214
{
215
public
:
216
/**
217
* The best matching OpenGL type for the specified template parameter.
218
*/
219
typedef
float
Type
;
220
221
/**
222
* The enum type of OpenGL
223
*/
224
static
const
GLenum
TypeEnum
= GL_FLOAT;
225
226
/**
227
* The value for full intensity.
228
*
229
* \return the full intensity value
230
*/
231
static
Type
FullIntensity
(){
return
1.0; }
// NOLINT
232
};
233
234
/**
235
* Class helping to adapt types specified as template parameter into the best matching OpenGL type.
236
*
237
* \note integral types get downscaled to float. This is done for easiness but might be better if the real type is used instead.
238
*/
239
template
<>
240
class
GLType
< int32_t >
241
{
242
public
:
243
/**
244
* The best matching OpenGL type for the specified template parameter.
245
*/
246
typedef
float
Type
;
247
248
/**
249
* The enum type of OpenGL
250
*/
251
static
const
GLenum
TypeEnum
= GL_FLOAT;
252
253
/**
254
* The value for full intensity.
255
*
256
* \return the full intensity value
257
*/
258
static
Type
FullIntensity
(){
return
1.0; }
// NOLINT
259
};
260
261
/**
262
* Class helping to adapt types specified as template parameter into the best matching OpenGL type.
263
*
264
* \note integral types get downscaled to float. This is done for easiness but might be better if the real type is used instead.
265
*/
266
template
<>
267
class
GLType
< uint32_t >
268
{
269
public
:
270
/**
271
* The best matching OpenGL type for the specified template parameter.
272
*/
273
typedef
float
Type
;
274
275
/**
276
* The enum type of OpenGL
277
*/
278
static
const
GLenum
TypeEnum
= GL_FLOAT;
279
280
/**
281
* The value for full intensity.
282
*
283
* \return the full intensity value
284
*/
285
static
Type
FullIntensity
(){
return
1.0; }
// NOLINT
286
};
287
288
/**
289
* Class helping to adapt types specified as template parameter into the best matching OpenGL type.
290
*
291
* \note integral types get downscaled to float. This is done for easiness but might be better if the real type is used instead.
292
*/
293
template
<>
294
class
GLType
< int64_t >
295
{
296
public
:
297
/**
298
* The best matching OpenGL type for the specified template parameter.
299
*/
300
typedef
float
Type
;
301
302
/**
303
* The enum type of OpenGL
304
*/
305
static
const
GLenum
TypeEnum
= GL_FLOAT;
306
307
/**
308
* The value for full intensity.
309
*
310
* \return the full intensity value
311
*/
312
static
Type
FullIntensity
(){
return
1.0; }
// NOLINT
313
};
314
315
/**
316
* Class helping to adapt types specified as template parameter into the best matching OpenGL type.
317
*
318
* \note integral types get downscaled to float. This is done for easiness but might be better if the real type is used instead.
319
*/
320
template
<>
321
class
GLType
< uint64_t >
322
{
323
public
:
324
/**
325
* The best matching OpenGL type for the specified template parameter.
326
*/
327
typedef
float
Type
;
328
329
/**
330
* The enum type of OpenGL
331
*/
332
static
const
GLenum
TypeEnum
= GL_FLOAT;
333
334
/**
335
* The value for full intensity.
336
*
337
* \return the full intensity value
338
*/
339
static
Type
FullIntensity
(){
return
1.0; }
// NOLINT
340
};
341
}
342
343
#endif // WGETYPETRAITS_H
344
Generated by
1.8.3.1