type_half.hpp Source File

- Main Page
- Modules
- Namespaces
- Classes
- Files

- File List

# type_half.hpp

    00001
    00002 // OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
    00004 // Created : 2008-08-17
    00005 // Updated : 2010-02-17
    00006 // Licence : This source is under MIT License
    00007 // File    : glm/core/type_half.hpp
    00009
    00010 #ifndef glm_core_type_half
    00011 #define glm_core_type_half
    00012
    00013 #include <cstdlib>
    00014
    00015 namespace glm
    00016 {
    00017         namespace test
    00018         {
    00019                 bool main_type_half();
    00020
    00021         }//namespace test
    00022
    00023         namespace detail
    00024         {
    00025                 typedef short hdata;
    00026
    00027                 float toFloat32(hdata value);
    00028                 hdata toFloat16(float const & value);
    00029
    00032                 class thalf
    00033                 {
    00034                 public:
    00035                         // Constructors
    00036                         thalf();
    00037                         thalf(thalf const & s);
    00038
    00039                         template <typename U>
    00040                         explicit thalf(U const & s);
    00041
    00042                         // Cast
    00043                         //operator float();
    00044                         operator float() const;
    00045                         //operator double();
    00046                         //operator double() const;
    00047
    00048                         // Unary updatable operators
    00049                         thalf& operator= (thalf const & s);
    00050                         thalf& operator+=(thalf const & s);
    00051                         thalf& operator-=(thalf const & s);
    00052                         thalf& operator*=(thalf const & s);
    00053                         thalf& operator/=(thalf const & s);
    00054                         thalf& operator++();
    00055                         thalf& operator--();
    00056
    00057                         float toFloat() const{return toFloat32(data);}
    00058
    00059                         hdata _data() const{return data;}
    00060
    00061                 private:
    00062                         hdata data;
    00063                 };
    00064
    00065                 thalf operator+ (thalf const & s1, thalf const & s2);
    00066
    00067                 thalf operator- (thalf const & s1, thalf const & s2);
    00068
    00069                 thalf operator* (thalf const & s1, thalf const & s2);
    00070
    00071                 thalf operator/ (thalf const & s1, thalf const & s2);
    00072
    00073                 // Unary constant operators
    00074                 thalf operator- (thalf const & s);
    00075
    00076                 thalf operator-- (thalf const & s, int);
    00077
    00078                 thalf operator++ (thalf const & s, int);
    00079
    00080         }//namespace detail
    00081
    00082
    00083 }//namespace glm
    00084
    00085 #include "type_half.inl"
    00086
    00087 #endif//glm_core_type_half