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 {
00028 enum ctor{null};
00029 typedef thalf value_type;
00030 typedef std::size_t size_type;
00031 static size_type value_size();
00032
00033 typedef tvec2<thalf> type;
00034 typedef tvec2<bool> bool_type;
00035
00037
00038
00039 thalf x, y;
00040
00042
00043
00044 thalf & operator[](size_type i);
00045 thalf const & operator[](size_type i) const;
00046
00048
00049
00050 tvec2();
00051 tvec2(tvec2<thalf> const & v);
00052
00054
00055
00056 explicit tvec2(ctor);
00057 explicit tvec2(
00058 thalf const & s);
00059 explicit tvec2(
00060 thalf const & s1,
00061 thalf const & s2);
00062
00064
00065
00066 tvec2(tref2<thalf> const & r);
00067
00069
00070
00072 template <typename U>
00073 explicit tvec2(U const & x);
00075 template <typename U, typename V>
00076 explicit tvec2(U const & x, V const & y);
00077
00079
00080
00082 template <typename U>
00083 explicit tvec2(tvec2<U> const & v);
00085 template <typename U>
00086 explicit tvec2(tvec3<U> const & v);
00088 template <typename U>
00089 explicit tvec2(tvec4<U> const & v);
00090
00092
00093
00094 tvec2<thalf>& operator= (tvec2<thalf> const & v);
00095
00096 tvec2<thalf>& operator+=(thalf const & s);
00097 tvec2<thalf>& operator+=(tvec2<thalf> const & v);
00098 tvec2<thalf>& operator-=(thalf const & s);
00099 tvec2<thalf>& operator-=(tvec2<thalf> const & v);
00100 tvec2<thalf>& operator*=(thalf const & s);
00101 tvec2<thalf>& operator*=(tvec2<thalf> const & v);
00102 tvec2<thalf>& operator/=(thalf const & s);
00103 tvec2<thalf>& operator/=(tvec2<thalf> const & v);
00104 tvec2<thalf>& operator++();
00105 tvec2<thalf>& operator--();
00106
00108
00109
00110 thalf swizzle(comp X) const;
00111 tvec2<thalf> swizzle(comp X, comp Y) const;
00112 tvec3<thalf> swizzle(comp X, comp Y, comp Z) const;
00113 tvec4<thalf> swizzle(comp X, comp Y, comp Z, comp W) const;
00114 tref2<thalf> swizzle(comp X, comp Y);
00115 };
00116
00117 template <>
00118 struct tvec3<thalf>
00119 {
00120 enum ctor{null};
00121 typedef thalf value_type;
00122 typedef std::size_t size_type;
00123 static size_type value_size();
00124
00125 typedef tvec3<thalf> type;
00126 typedef tvec3<bool> bool_type;
00127
00129
00130
00131 thalf x, y, z;
00132
00134
00135
00136 thalf & operator[](size_type i);
00137 thalf const & operator[](size_type i) const;
00138
00140
00141
00142 tvec3();
00143 tvec3(tvec3<thalf> const & v);
00144
00146
00147
00148 explicit tvec3(ctor);
00149 explicit tvec3(
00150 thalf const & s);
00151 explicit tvec3(
00152 thalf const & s1,
00153 thalf const & s2,
00154 thalf const & s3);
00155
00157
00158
00159 tvec3(tref3<thalf> const & r);
00160
00162
00163
00165 template <typename U>
00166 explicit tvec3(U const & x);
00168 template <typename U, typename V, typename W>
00169 explicit tvec3(U const & x, V const & y, W const & z);
00170
00172
00173
00175 template <typename A, typename B>
00176 explicit tvec3(tvec2<A> const & v, B const & s);
00178 template <typename A, typename B>
00179 explicit tvec3(A const & s, tvec2<B> const & v);
00181 template <typename U>
00182 explicit tvec3(tvec3<U> const & v);
00184 template <typename U>
00185 explicit tvec3(tvec4<U> const & v);
00186
00188
00189
00190 tvec3<thalf>& operator= (tvec3<thalf> const & v);
00191
00192 tvec3<thalf>& operator+=(thalf const & s);
00193 tvec3<thalf>& operator+=(tvec3<thalf> const & v);
00194 tvec3<thalf>& operator-=(thalf const & s);
00195 tvec3<thalf>& operator-=(tvec3<thalf> const & v);
00196 tvec3<thalf>& operator*=(thalf const & s);
00197 tvec3<thalf>& operator*=(tvec3<thalf> const & v);
00198 tvec3<thalf>& operator/=(thalf const & s);
00199 tvec3<thalf>& operator/=(tvec3<thalf> const & v);
00200 tvec3<thalf>& operator++();
00201 tvec3<thalf>& operator--();
00202
00204
00205
00206 thalf swizzle(comp X) const;
00207 tvec2<thalf> swizzle(comp X, comp Y) const;
00208 tvec3<thalf> swizzle(comp X, comp Y, comp Z) const;
00209 tvec4<thalf> swizzle(comp X, comp Y, comp Z, comp W) const;
00210 tref3<thalf> swizzle(comp X, comp Y, comp Z);
00211 };
00212
00213 template <>
00214 struct tvec4<thalf>
00215 {
00216 enum ctor{null};
00217 typedef thalf value_type;
00218 typedef std::size_t size_type;
00219 static size_type value_size();
00220
00221 typedef tvec4<thalf> type;
00222 typedef tvec4<bool> bool_type;
00223
00225
00226
00227 thalf x, y, z, w;
00228
00230
00231
00232 thalf & operator[](size_type i);
00233 thalf const & operator[](size_type i) const;
00234
00236
00237
00238 tvec4();
00239 tvec4(tvec4<thalf> const & v);
00240
00242
00243
00244 explicit tvec4(ctor);
00245 explicit tvec4(
00246 thalf const & s);
00247 explicit tvec4(
00248 thalf const & s0,
00249 thalf const & s1,
00250 thalf const & s2,
00251 thalf const & s3);
00252
00254
00255
00256 tvec4(tref4<thalf> const & r);
00257
00259
00260
00262 template <typename U>
00263 explicit tvec4(U const & x);
00265 template <typename A, typename B, typename C, typename D>
00266 explicit tvec4(A const & x, B const & y, C const & z, D const & w);
00267
00269
00270
00272 template <typename A, typename B, typename C>
00273 explicit tvec4(tvec2<A> const & v, B const & s1, C const & s2);
00275 template <typename A, typename B, typename C>
00276 explicit tvec4(A const & s1, tvec2<B> const & v, C const & s2);
00278 template <typename A, typename B, typename C>
00279 explicit tvec4(A const & s1, B const & s2, tvec2<C> const & v);
00281 template <typename A, typename B>
00282 explicit tvec4(tvec3<A> const & v, B const & s);
00284 template <typename A, typename B>
00285 explicit tvec4(A const & s, tvec3<B> const & v);
00287 template <typename A, typename B>
00288 explicit tvec4(tvec2<A> const & v1, tvec2<B> const & v2);
00290 template <typename U>
00291 explicit tvec4(tvec4<U> const & v);
00292
00294
00295
00296 tvec4<thalf>& operator= (tvec4<thalf> const & v);
00297
00298 tvec4<thalf>& operator+=(thalf const & s);
00299 tvec4<thalf>& operator+=(tvec4<thalf> const & v);
00300 tvec4<thalf>& operator-=(thalf const & s);
00301 tvec4<thalf>& operator-=(tvec4<thalf> const & v);
00302 tvec4<thalf>& operator*=(thalf const & s);
00303 tvec4<thalf>& operator*=(tvec4<thalf> const & v);
00304 tvec4<thalf>& operator/=(thalf const & s);
00305 tvec4<thalf>& operator/=(tvec4<thalf> const & v);
00306 tvec4<thalf>& operator++();
00307 tvec4<thalf>& operator--();
00308
00310
00311
00312 thalf swizzle(comp X) const;
00313 tvec2<thalf> swizzle(comp X, comp Y) const;
00314 tvec3<thalf> swizzle(comp X, comp Y, comp Z) const;
00315 tvec4<thalf> swizzle(comp X, comp Y, comp Z, comp W) const;
00316 tref4<thalf> swizzle(comp X, comp Y, comp Z, comp W);
00317 };
00318 #endif//GLM_USE_ANONYMOUS_UNION
00319 }
00320
00321
00322 namespace gtc{
00324 namespace half_float
00325 {
00328 typedef detail::thalf half;
00329
00332 typedef detail::tvec2<detail::thalf> hvec2;
00333
00336 typedef detail::tvec3<detail::thalf> hvec3;
00337
00340 typedef detail::tvec4<detail::thalf> hvec4;
00341
00344 typedef detail::tmat2x2<detail::thalf> hmat2;
00345
00348 typedef detail::tmat3x3<detail::thalf> hmat3;
00349
00352 typedef detail::tmat4x4<detail::thalf> hmat4;
00353
00354 }
00355 }
00356 }
00357
00358 #include "half_float.inl"
00359
00360 namespace glm{using namespace gtc::half_float;}
00361
00362 #endif//glm_gtc_half_float