00001
00002
00004
00005
00006
00007
00009
00010 #ifndef glm_gtc_half_float
00011 #define glm_gtc_half_float
00012
00013
00014 #include "../glm.hpp"
00015
00016 namespace glm
00017 {
00018 namespace test{
00019 bool main_gtc_half_float();
00020 }
00021
00022 namespace detail
00023 {
00024 #ifndef GLM_USE_ANONYMOUS_UNION
00025 template <>
00026 struct tvec2<thalf>
00027 {
00029
00030
00031 typedef thalf value_type;
00032 typedef thalf& value_reference;
00033 typedef thalf* value_pointer;
00034 typedef tvec2<bool> bool_type;
00035
00036 typedef sizeType size_type;
00037 static size_type value_size();
00038 static bool is_vector();
00039
00040 typedef tvec2<thalf> type;
00041 typedef tvec2<thalf>* pointer;
00042 typedef const tvec2<thalf>* const_pointer;
00043 typedef const tvec2<thalf>*const const_pointer_const;
00044 typedef tvec2<thalf>*const pointer_const;
00045 typedef tvec2<thalf>& reference;
00046 typedef const tvec2<thalf>& const_reference;
00047 typedef const tvec2<thalf>& param_type;
00048
00050
00051
00052 thalf x, y;
00053
00055
00056
00057 thalf& operator[](size_type i);
00058 thalf operator[](size_type i) const;
00059
00061
00062
00063 thalf const * const _address() const{return (value_type*)(this);}
00064 thalf * _address(){return (value_type*)(this);}
00065
00067
00068
00069 tvec2();
00070 tvec2(tvec2<thalf> const & v);
00071
00073
00074
00075 explicit tvec2(thalf s);
00076 explicit tvec2(thalf s1, thalf s2);
00077
00079
00080
00081 tvec2(tref2<thalf> const & r);
00082
00084
00085
00087 template <typename U>
00088 explicit tvec2(U x);
00090 template <typename U, typename V>
00091 explicit tvec2(U x, V y);
00092
00094
00095
00097 template <typename U>
00098 explicit tvec2(tvec2<U> const & v);
00100 template <typename U>
00101 explicit tvec2(tvec3<U> const & v);
00103 template <typename U>
00104 explicit tvec2(tvec4<U> const & v);
00105
00107
00108
00109 tvec2<thalf>& operator= (tvec2<thalf> const & v);
00110
00111 tvec2<thalf>& operator+=(thalf s);
00112 tvec2<thalf>& operator+=(tvec2<thalf> const & v);
00113 tvec2<thalf>& operator-=(thalf s);
00114 tvec2<thalf>& operator-=(tvec2<thalf> const & v);
00115 tvec2<thalf>& operator*=(thalf s);
00116 tvec2<thalf>& operator*=(tvec2<thalf> const & v);
00117 tvec2<thalf>& operator/=(thalf s);
00118 tvec2<thalf>& operator/=(tvec2<thalf> const & v);
00119 tvec2<thalf>& operator++();
00120 tvec2<thalf>& operator--();
00121
00123
00124
00125 thalf swizzle(comp X) const;
00126 tvec2<thalf> swizzle(comp X, comp Y) const;
00127 tvec3<thalf> swizzle(comp X, comp Y, comp Z) const;
00128 tvec4<thalf> swizzle(comp X, comp Y, comp Z, comp W) const;
00129 tref2<thalf> swizzle(comp X, comp Y);
00130 };
00131
00132 template <>
00133 struct tvec3<thalf>
00134 {
00136
00137
00138 typedef thalf value_type;
00139 typedef thalf& value_reference;
00140 typedef thalf* value_pointer;
00141 typedef tvec3<bool> bool_type;
00142
00143 typedef glm::sizeType size_type;
00144 static size_type value_size();
00145 static bool is_vector();
00146
00147 typedef tvec3<thalf> type;
00148 typedef tvec3<thalf> * pointer;
00149 typedef tvec3<thalf> const * const_pointer;
00150 typedef tvec3<thalf> const * const const_pointer_const;
00151 typedef tvec3<thalf> * const pointer_const;
00152 typedef tvec3<thalf> & reference;
00153 typedef tvec3<thalf> const & const_reference;
00154 typedef tvec3<thalf> const & param_type;
00155
00157
00158
00159 thalf x, y, z;
00160
00162
00163
00164 thalf& operator[](size_type i);
00165 thalf operator[](size_type i) const;
00166
00168
00169
00170 const value_type* _address() const{return (value_type*)(this);}
00171 value_type* _address(){return (value_type*)(this);}
00172
00174
00175
00176 tvec3();
00177 tvec3(tvec3<thalf> const & v);
00178
00180
00181
00182 explicit tvec3(thalf s);
00183 explicit tvec3(thalf s1, thalf s2, thalf s3);
00184
00186
00187
00188 tvec3(tref3<thalf> const & r);
00189
00191
00192
00194 template <typename U>
00195 explicit tvec3(U x);
00197 template <typename U, typename V, typename W>
00198 explicit tvec3(U x, V y, W z);
00199
00201
00202
00204 template <typename A, typename B>
00205 explicit tvec3(const tvec2<A>& v, B s);
00207 template <typename A, typename B>
00208 explicit tvec3(A s, const tvec2<B>& v);
00210 template <typename U>
00211 explicit tvec3(tvec3<U> const & v);
00213 template <typename U>
00214 explicit tvec3(tvec4<U> const & v);
00215
00217
00218
00219 tvec3<thalf>& operator= (tvec3<thalf> const & v);
00220
00221 tvec3<thalf>& operator+=(thalf s);
00222 tvec3<thalf>& operator+=(tvec3<thalf> const & v);
00223 tvec3<thalf>& operator-=(thalf s);
00224 tvec3<thalf>& operator-=(tvec3<thalf> const & v);
00225 tvec3<thalf>& operator*=(thalf s);
00226 tvec3<thalf>& operator*=(tvec3<thalf> const & v);
00227 tvec3<thalf>& operator/=(thalf s);
00228 tvec3<thalf>& operator/=(tvec3<thalf> const & v);
00229 tvec3<thalf>& operator++();
00230 tvec3<thalf>& operator--();
00231
00233
00234
00235 thalf swizzle(comp X) const;
00236 tvec2<thalf> swizzle(comp X, comp Y) const;
00237 tvec3<thalf> swizzle(comp X, comp Y, comp Z) const;
00238 tvec4<thalf> swizzle(comp X, comp Y, comp Z, comp W) const;
00239 tref3<thalf> swizzle(comp X, comp Y, comp Z);
00240 };
00241
00242 template <>
00243 struct tvec4<thalf>
00244 {
00246
00247
00248 typedef thalf value_type;
00249 typedef thalf& value_reference;
00250 typedef thalf* value_pointer;
00251 typedef tvec4<bool> bool_type;
00252
00253 typedef glm::sizeType size_type;
00254 static size_type value_size();
00255 static bool is_vector();
00256
00257 typedef tvec4<thalf> type;
00258 typedef tvec4<thalf> * pointer;
00259 typedef tvec4<thalf> const * const_pointer;
00260 typedef tvec4<thalf> const * const const_pointer_const;
00261 typedef tvec4<thalf> * const pointer_const;
00262 typedef tvec4<thalf> & reference;
00263 typedef tvec4<thalf> const & const_reference;
00264 typedef tvec4<thalf> const & param_type;
00265
00267
00268
00269 thalf x, y, z, w;
00270
00272
00273
00274 thalf& operator[](size_type i);
00275 thalf operator[](size_type i) const;
00276
00278
00279
00280 const value_type* _address() const{return (value_type*)(this);}
00281 value_type* _address(){return (value_type*)(this);}
00282
00284
00285
00286 tvec4();
00287 tvec4(tvec4<thalf> const & v);
00288
00290
00291
00292 explicit tvec4(thalf s);
00293 explicit tvec4(thalf s0, thalf s1, thalf s2, thalf s3);
00294
00296
00297
00298 tvec4(tref4<thalf> const & r);
00299
00301
00302
00304 template <typename U>
00305 explicit tvec4(U x);
00307 template <typename A, typename B, typename C, typename D>
00308 explicit tvec4(A x, B y, C z, D w);
00309
00311
00312
00314 template <typename A, typename B, typename C>
00315 explicit tvec4(const tvec2<A>& v, B s1, C s2);
00317 template <typename A, typename B, typename C>
00318 explicit tvec4(A s1, const tvec2<B>& v, C s2);
00320 template <typename A, typename B, typename C>
00321 explicit tvec4(A s1, B s2, const tvec2<C>& v);
00323 template <typename A, typename B>
00324 explicit tvec4(const tvec3<A>& v, B s);
00326 template <typename A, typename B>
00327 explicit tvec4(A s, const tvec3<B>& v);
00329 template <typename A, typename B>
00330 explicit tvec4(const tvec2<A>& v1, const tvec2<B>& v2);
00332 template <typename U>
00333 explicit tvec4(const tvec4<U>& v);
00334
00336
00337
00338 tvec4<thalf>& operator= (tvec4<thalf> const & v);
00339
00340 tvec4<thalf>& operator+=(thalf s);
00341 tvec4<thalf>& operator+=(tvec4<thalf> const & v);
00342 tvec4<thalf>& operator-=(thalf s);
00343 tvec4<thalf>& operator-=(tvec4<thalf> const & v);
00344 tvec4<thalf>& operator*=(thalf s);
00345 tvec4<thalf>& operator*=(tvec4<thalf> const & v);
00346 tvec4<thalf>& operator/=(thalf s);
00347 tvec4<thalf>& operator/=(tvec4<thalf> const & v);
00348 tvec4<thalf>& operator++();
00349 tvec4<thalf>& operator--();
00350
00352
00353
00354 thalf swizzle(comp X) const;
00355 tvec2<thalf> swizzle(comp X, comp Y) const;
00356 tvec3<thalf> swizzle(comp X, comp Y, comp Z) const;
00357 tvec4<thalf> swizzle(comp X, comp Y, comp Z, comp W) const;
00358 tref4<thalf> swizzle(comp X, comp Y, comp Z, comp W);
00359 };
00360 #endif//GLM_USE_ANONYMOUS_UNION
00361 }
00362
00363
00364 namespace gtc{
00366 namespace half_float
00367 {
00370 typedef detail::thalf half;
00371
00374 typedef detail::tvec2<detail::thalf> hvec2;
00375
00378 typedef detail::tvec3<detail::thalf> hvec3;
00379
00382 typedef detail::tvec4<detail::thalf> hvec4;
00383
00386 typedef detail::tmat2x2<detail::thalf> hmat2;
00387
00390 typedef detail::tmat3x3<detail::thalf> hmat3;
00391
00394 typedef detail::tmat4x4<detail::thalf> hmat4;
00395
00396 }
00397 }
00398 }
00399
00400 #define GLM_GTC_half_float namespace gtc::half_float
00401 #ifndef GLM_GTC_GLOBAL
00402 namespace glm {using GLM_GTC_half_float;}
00403 #endif//GLM_GTC_GLOBAL
00404
00405 #include "half_float.inl"
00406
00407 #endif//glm_gtc_half_float