00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037 #ifndef GLM_GTC_half_float
00038 #define GLM_GTC_half_float GLM_VERSION
00039
00040
00041 #include "../glm.hpp"
00042
00043 #if(defined(GLM_MESSAGES) && !defined(glm_ext))
00044 # pragma message("GLM: GLM_GTC_half_float extension included")
00045 #endif
00046
00047 namespace glm{
00048 namespace detail
00049 {
00050 #if(!GLM_SUPPORT_ANONYMOUS_UNION_OF_STRUCTURE())
00051 template <>
00052 struct tvec2<thalf>
00053 {
00054 enum ctor{null};
00055 typedef thalf value_type;
00056 typedef std::size_t size_type;
00057
00058 GLM_FUNC_DECL size_type length() const;
00059 static GLM_FUNC_DECL size_type value_size();
00060
00061 typedef tvec2<thalf> type;
00062 typedef tvec2<bool> bool_type;
00063
00065
00066
00067 thalf x, y;
00068
00070
00071
00072 thalf & operator[](size_type i);
00073 thalf const & operator[](size_type i) const;
00074
00076
00077
00078 tvec2();
00079 tvec2(tvec2<thalf> const & v);
00080
00082
00083
00084 explicit tvec2(ctor);
00085 explicit tvec2(
00086 thalf const & s);
00087 explicit tvec2(
00088 thalf const & s1,
00089 thalf const & s2);
00090
00092
00093
00094 tvec2(tref2<thalf> const & r);
00095
00097
00098
00100 template <typename U>
00101 explicit tvec2(U const & x);
00103 template <typename U, typename V>
00104 explicit tvec2(U const & x, V const & y);
00105
00107
00108
00110 template <typename U>
00111 explicit tvec2(tvec2<U> const & v);
00113 template <typename U>
00114 explicit tvec2(tvec3<U> const & v);
00116 template <typename U>
00117 explicit tvec2(tvec4<U> const & v);
00118
00120
00121
00122 tvec2<thalf>& operator= (tvec2<thalf> const & v);
00123
00124 tvec2<thalf>& operator+=(thalf const & s);
00125 tvec2<thalf>& operator+=(tvec2<thalf> const & v);
00126 tvec2<thalf>& operator-=(thalf const & s);
00127 tvec2<thalf>& operator-=(tvec2<thalf> const & v);
00128 tvec2<thalf>& operator*=(thalf const & s);
00129 tvec2<thalf>& operator*=(tvec2<thalf> const & v);
00130 tvec2<thalf>& operator/=(thalf const & s);
00131 tvec2<thalf>& operator/=(tvec2<thalf> const & v);
00132 tvec2<thalf>& operator++();
00133 tvec2<thalf>& operator--();
00134
00136
00137
00138 thalf swizzle(comp X) const;
00139 tvec2<thalf> swizzle(comp X, comp Y) const;
00140 tvec3<thalf> swizzle(comp X, comp Y, comp Z) const;
00141 tvec4<thalf> swizzle(comp X, comp Y, comp Z, comp W) const;
00142 tref2<thalf> swizzle(comp X, comp Y);
00143 };
00144
00145 template <>
00146 struct tvec3<thalf>
00147 {
00148 enum ctor{null};
00149 typedef thalf value_type;
00150 typedef std::size_t size_type;
00151 GLM_FUNC_DECL size_type length() const;
00152 static GLM_FUNC_DECL size_type value_size();
00153
00154 typedef tvec3<thalf> type;
00155 typedef tvec3<bool> bool_type;
00156
00158
00159
00160 thalf x, y, z;
00161
00163
00164
00165 thalf & operator[](size_type i);
00166 thalf const & operator[](size_type i) const;
00167
00169
00170
00171 tvec3();
00172 tvec3(tvec3<thalf> const & v);
00173
00175
00176
00177 explicit tvec3(ctor);
00178 explicit tvec3(
00179 thalf const & s);
00180 explicit tvec3(
00181 thalf const & s1,
00182 thalf const & s2,
00183 thalf const & s3);
00184
00186
00187
00188 tvec3(tref3<thalf> const & r);
00189
00191
00192
00194 template <typename U>
00195 explicit tvec3(U const & x);
00197 template <typename U, typename V, typename W>
00198 explicit tvec3(U const & x, V const & y, W const & z);
00199
00201
00202
00204 template <typename A, typename B>
00205 explicit tvec3(tvec2<A> const & v, B const & s);
00207 template <typename A, typename B>
00208 explicit tvec3(A const & s, tvec2<B> const & 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 const & s);
00222 tvec3<thalf>& operator+=(tvec3<thalf> const & v);
00223 tvec3<thalf>& operator-=(thalf const & s);
00224 tvec3<thalf>& operator-=(tvec3<thalf> const & v);
00225 tvec3<thalf>& operator*=(thalf const & s);
00226 tvec3<thalf>& operator*=(tvec3<thalf> const & v);
00227 tvec3<thalf>& operator/=(thalf const & 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 {
00245 enum ctor{null};
00246 typedef thalf value_type;
00247 typedef std::size_t size_type;
00248 GLM_FUNC_DECL size_type length() const;
00249 static GLM_FUNC_DECL size_type value_size();
00250
00251 typedef tvec4<thalf> type;
00252 typedef tvec4<bool> bool_type;
00253
00255
00256
00257 thalf x, y, z, w;
00258
00260
00261
00262 thalf & operator[](size_type i);
00263 thalf const & operator[](size_type i) const;
00264
00266
00267
00268 tvec4();
00269 tvec4(tvec4<thalf> const & v);
00270
00272
00273
00274 explicit tvec4(ctor);
00275 explicit tvec4(
00276 thalf const & s);
00277 explicit tvec4(
00278 thalf const & s0,
00279 thalf const & s1,
00280 thalf const & s2,
00281 thalf const & s3);
00282
00284
00285
00286 tvec4(tref4<thalf> const & r);
00287
00289
00290
00292 template <typename U>
00293 explicit tvec4(U const & x);
00295 template <typename A, typename B, typename C, typename D>
00296 explicit tvec4(A const & x, B const & y, C const & z, D const & w);
00297
00299
00300
00302 template <typename A, typename B, typename C>
00303 explicit tvec4(tvec2<A> const & v, B const & s1, C const & s2);
00305 template <typename A, typename B, typename C>
00306 explicit tvec4(A const & s1, tvec2<B> const & v, C const & s2);
00308 template <typename A, typename B, typename C>
00309 explicit tvec4(A const & s1, B const & s2, tvec2<C> const & v);
00311 template <typename A, typename B>
00312 explicit tvec4(tvec3<A> const & v, B const & s);
00314 template <typename A, typename B>
00315 explicit tvec4(A const & s, tvec3<B> const & v);
00317 template <typename A, typename B>
00318 explicit tvec4(tvec2<A> const & v1, tvec2<B> const & v2);
00320 template <typename U>
00321 explicit tvec4(tvec4<U> const & v);
00322
00324
00325
00326 tvec4<thalf>& operator= (tvec4<thalf> const & v);
00327
00328 tvec4<thalf>& operator+=(thalf const & s);
00329 tvec4<thalf>& operator+=(tvec4<thalf> const & v);
00330 tvec4<thalf>& operator-=(thalf const & s);
00331 tvec4<thalf>& operator-=(tvec4<thalf> const & v);
00332 tvec4<thalf>& operator*=(thalf const & s);
00333 tvec4<thalf>& operator*=(tvec4<thalf> const & v);
00334 tvec4<thalf>& operator/=(thalf const & s);
00335 tvec4<thalf>& operator/=(tvec4<thalf> const & v);
00336 tvec4<thalf>& operator++();
00337 tvec4<thalf>& operator--();
00338
00340
00341
00342 thalf swizzle(comp X) const;
00343 tvec2<thalf> swizzle(comp X, comp Y) const;
00344 tvec3<thalf> swizzle(comp X, comp Y, comp Z) const;
00345 tvec4<thalf> swizzle(comp X, comp Y, comp Z, comp W) const;
00346 tref4<thalf> swizzle(comp X, comp Y, comp Z, comp W);
00347 };
00348 #endif//(!GLM_SUPPORT_ANONYMOUS_UNION_OF_STRUCTURE())
00349 }
00350
00351
00354
00357 typedef detail::thalf half;
00358
00361 typedef detail::tvec2<detail::thalf> hvec2;
00362
00365 typedef detail::tvec3<detail::thalf> hvec3;
00366
00369 typedef detail::tvec4<detail::thalf> hvec4;
00370
00373 typedef detail::tmat2x2<detail::thalf> hmat2;
00374
00377 typedef detail::tmat3x3<detail::thalf> hmat3;
00378
00381 typedef detail::tmat4x4<detail::thalf> hmat4;
00382
00385 typedef detail::tmat2x2<detail::thalf> hmat2x2;
00386
00389 typedef detail::tmat2x3<detail::thalf> hmat2x3;
00390
00393 typedef detail::tmat2x4<detail::thalf> hmat2x4;
00394
00397 typedef detail::tmat3x2<detail::thalf> hmat3x2;
00398
00401 typedef detail::tmat3x3<detail::thalf> hmat3x3;
00402
00405 typedef detail::tmat3x4<detail::thalf> hmat3x4;
00406
00409 typedef detail::tmat4x2<detail::thalf> hmat4x2;
00410
00413 typedef detail::tmat4x3<detail::thalf> hmat4x3;
00414
00417 typedef detail::tmat4x4<detail::thalf> hmat4x4;
00418
00420 }
00421
00422 #include "half_float.inl"
00423
00424 #endif//GLM_GTC_half_float