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 #ifndef CL_VECTORS_TMPL_2_h
00030 #define CL_VECTORS_TMPL_2_h
00031
00032 #include "SugoiTools\cl_vectors_template.h"
00033
00034 #if SG_TLS_MEMORY_MANAGER
00035 #include "SugoiTools\debug_new.h"
00036 #endif
00037
00038
00039 namespace SGE{
00040
00041 template <typename TType> class CL_Vector2D;
00042 typedef CL_Vector2D<float> CL_Vector2Df;
00043 typedef CL_Vector2D<int> CL_Vector2Di;
00044 typedef CL_Vector2D<double> CL_Vector2Dd;
00045
00046
00047
00048
00049
00050
00057 template <typename TType> class CL_Vector2D : public CLT_Vector<TType>
00058 {
00059 public :
00060 TType &x;
00061 TType &y;
00062
00063
00064
00069 CL_Vector2D()
00070 :CLT_Vector<TType>(2,0.),
00071 x( CLT_Vector<TType>::vec[0]),
00072 y( CLT_Vector<TType>::vec[1])
00073 {};
00074
00075
00080 CL_Vector2D(const CLT_Vector<TType> &_Vec)
00081 : CLT_Vector<TType>(_Vec),
00082 x( CLT_Vector<TType>::vec[0]),
00083 y( CLT_Vector<TType>::vec[1])
00084 {};
00085
00086
00092 CL_Vector2D(const CL_Vector2D<TType> &_Vec)
00093 :CLT_Vector<TType>(_Vec),
00094 x( CLT_Vector<TType>::vec[0]),
00095 y( CLT_Vector<TType>::vec[1])
00096 {};
00097
00103 CL_Vector2D(const TType * _Val)
00104 :CLT_Vector<TType>(2, _Val),
00105 x( CLT_Vector<TType>::vec[0]),
00106 y( CLT_Vector<TType>::vec[1])
00107 {};
00108
00109
00115 CL_Vector2D(const TType _Val)
00116 :CLT_Vector<TType>(2, _Val),
00117 x( CLT_Vector<TType>::vec[0]),
00118 y( CLT_Vector<TType>::vec[1])
00119 {};
00120
00127 CL_Vector2D(const TType _x, const TType _y)
00128 :CLT_Vector<TType>(2,0.),
00129 x( CLT_Vector<TType>::vec[0]),
00130 y( CLT_Vector<TType>::vec[1])
00131 {
00132 Set(_x, _y);
00133 };
00134
00139 ~CL_Vector2D()
00140 {};
00141
00142
00143
00150 void
00151 Set(const TType _x, const TType _y)
00152 { x=_x; y=_y; }
00153
00154
00155 CL_Vector2D<TType> &
00156 operator= (const CL_Vector2D<TType> & _Vec2)
00157 {
00158 VECTOR_OP_EQUAL(this, _Vec2.vec[i], , GetDim());
00159 return(*this);
00160 }
00161
00162
00163 CL_Vector2D<TType> &
00164 operator= (const TType * _Val)
00165 {
00166 SG_Assert(_Val, "Given Value is NULL");
00167 VECTOR_OP_EQUAL(this, _Val[i], , GetDim());
00168 return(*this);
00169 }
00170
00171 CL_Vector2D<TType> &
00172 operator= (const TType _Val)
00173 {
00174 VECTOR_OP_EQUAL(this, _Val, , GetDim());
00175 return(*this);
00176 }
00177
00178
00179
00180
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190 };
00191
00192 _SG_TLS_EXPORT _SG_TLS_INLINE std::ostream& operator<< (std::ostream& s, const CL_Vector2D<typename>& _v);
00193
00194
00195
00196
00197
00198
00199
00200
00201
00202
00203
00204
00205 };
00206
00207 #if SG_TLS_MEMORY_MANAGER
00208 #include "SugoiTools\debug_new_off.h"
00209 #endif
00210
00211
00212
00213 #endif//CL_VECTORS_TMPL_2_h