- Main Page
- Namespaces
- Files

- File List

# type_vec1.hpp

    00001
    00002 // OpenGL Mathematics Copyright (c) 2005 - 2010 G-Truc Creation (www.g-truc.net)
    00004 // Created : 2008-08-25
    00005 // Updated : 2010-02-04
    00006 // Licence : This source is under MIT License
    00007 // File    : glm/core/type_vec1.hpp
    00009
    00010 #ifndef glm_core_type_gentype1
    00011 #define glm_core_type_gentype1
    00012
    00013 #include "type_vec.hpp"
    00014 #include "type_float.hpp"
    00015 #include "type_int.hpp"
    00016 #include "type_size.hpp"
    00017 #include "_swizzle.hpp"
    00018
    00019 namespace glm
    00020 {
    00021         namespace test
    00022         {
    00023                 void main_vec1();
    00024         }//namespace test
    00025
    00026         namespace detail
    00027         {
    00028                 template <typename T> struct tref1;
    00029                 template <typename T> struct tref2;
    00030                 template <typename T> struct tref3;
    00031                 template <typename T> struct tref4;
    00032                 template <typename T> struct tvec1;
    00033                 template <typename T> struct tvec2;
    00034                 template <typename T> struct tvec3;
    00035                 template <typename T> struct tvec4;
    00036
    00037                 template <typename T>
    00038                 struct tvec1
    00039                 {
    00040                         enum ctor{null};
    00041                         typedef T value_type;
    00042                         typedef std::size_t size_type;
    00043                         static size_type value_size();
    00044
    00045                         typedef tvec1<T> type;
    00046                         typedef tvec1<bool> bool_type;
    00047
    00049                         // Data
    00050
    00051 #       if defined(GLM_USE_ONLY_XYZW)
    00052                         value_type x;
    00053 #       else//GLM_USE_ONLY_XYZW
    00054                         union {value_type x, r, s;};
    00055 #       endif//GLM_USE_ONLY_XYZW
    00056
    00058                         // Accesses
    00059
    00060                         value_type & operator[](size_type i);
    00061                         value_type const & operator[](size_type i) const;
    00062
    00064                         // Implicit basic constructors
    00065
    00066                         tvec1();
    00067                         tvec1(tvec1<T> const & v);
    00068
    00070                         // Explicit basic constructors
    00071
    00072                         explicit tvec1(
    00073                                 ctor);
    00074                         explicit tvec1(
    00075                                 value_type const & s);
    00076
    00078                         // Swizzle constructors
    00079
    00080                         tvec1(tref1<T> const & r);
    00081
    00083                         // Convertion scalar constructors
    00084
    00086                         template <typename U>
    00087                         explicit tvec1(U const & s);
    00088
    00090                         // Convertion vector constructors
    00091
    00093                         template <typename U>
    00094                         explicit tvec1(tvec2<U> const & v);
    00096                         template <typename U>
    00097                         explicit tvec1(tvec3<U> const & v);
    00099                         template <typename U>
    00100                         explicit tvec1(tvec4<U> const & v);
    00101
    00103                         // Unary arithmetic operators
    00104
    00105                         tvec1<T> & operator= (tvec1<T> const & v);
    00106
    00107                         tvec1<T> & operator+=(value_type const & s);
    00108                         tvec1<T> & operator+=(tvec1<T> const & v);
    00109                         tvec1<T> & operator-=(value_type const & s);
    00110                         tvec1<T> & operator-=(tvec1<T> const & v);
    00111                         tvec1<T> & operator*=(value_type const & s);
    00112                         tvec1<T> & operator*=(tvec1<T> const & v);
    00113                         tvec1<T> & operator/=(value_type const & s);
    00114                         tvec1<T> & operator/=(tvec1<T> const & v);
    00115                         tvec1<T> & operator++();
    00116                         tvec1<T> & operator--();
    00117
    00119                         // Unary bit operators
    00120
    00121                         tvec1<T> & operator%=(value_type const & s);
    00122                         tvec1<T> & operator%=(tvec1<T> const & v);
    00123                         tvec1<T> & operator&=(value_type const & s);
    00124                         tvec1<T> & operator&=(tvec1<T> const & v);
    00125                         tvec1<T> & operator|=(value_type const & s);
    00126                         tvec1<T> & operator|=(tvec1<T> const & v);
    00127                         tvec1<T> & operator^=(value_type const & s);
    00128                         tvec1<T> & operator^=(tvec1<T> const & v);
    00129                         tvec1<T> & operator<<=(value_type const & s);
    00130                         tvec1<T> & operator<<=(tvec1<T> const & v);
    00131                         tvec1<T> & operator>>=(value_type const & s);
    00132                         tvec1<T> & operator>>=(tvec1<T> const & v);
    00133
    00135                         // Swizzle operators
    00136
    00137                         value_type swizzle(comp X) const;
    00138                         tvec2<T> swizzle(comp X, comp Y) const;
    00139                         tvec3<T> swizzle(comp X, comp Y, comp Z) const;
    00140                         tvec4<T> swizzle(comp X, comp Y, comp Z, comp W) const;
    00141                         tref1<T> swizzle(comp X);
    00142                 };
    00143
    00144                 template <typename T>
    00145                 struct tref1
    00146                 {
    00147                         tref1(T & x);
    00148                         tref1(tref1<T> const & r);
    00149                         tref1(tvec1<T> const & v);
    00150
    00151                         tref1<T> & operator= (tref1<T> const & r);
    00152                         tref1<T> & operator= (tvec1<T> const & v);
    00153
    00154                         T& x;
    00155                 };
    00156
    00157                 typedef detail::tvec1<core::type::precision::highp_float>               highp_vec1_t;
    00158                 typedef detail::tvec1<core::type::precision::mediump_float>             mediump_vec1_t;
    00159                 typedef detail::tvec1<core::type::precision::lowp_float>                lowp_vec1_t;
    00160                 typedef detail::tvec1<core::type::precision::highp_int>                 highp_ivec1_t;
    00161                 typedef detail::tvec1<core::type::precision::mediump_int>               mediump_ivec1_t;
    00162                 typedef detail::tvec1<core::type::precision::lowp_int>                  lowp_ivec1_t;
    00163                 typedef detail::tvec1<core::type::precision::highp_uint>                highp_uvec1_t;
    00164                 typedef detail::tvec1<core::type::precision::mediump_uint>              mediump_uvec1_t;
    00165                 typedef detail::tvec1<core::type::precision::lowp_uint>                 lowp_uvec1_t;
    00166
    00167         } //namespace detail
    00168 }//namespace glm
    00169
    00170 #include "type_vec1.inl"
    00171
    00172 #endif//glm_core_type_gentype1