gKitGL
|
00001 00002 #ifndef _GLSL_UNIFORMS_H 00003 #define _GLSL_UNIFORMS_H 00004 00005 00006 namespace gk { 00007 00008 template < typename T > 00009 struct gvec2 00010 { 00011 T x; 00012 T y; 00013 } __attribute__((aligned (8))); 00014 00015 template < typename T > 00016 struct gvec3 00017 { 00018 T x; 00019 T y; 00020 T z; 00021 } __attribute__((aligned (16))); 00022 00023 template < typename T > 00024 struct gvec4 00025 { 00026 T x; 00027 T y; 00028 T z; 00029 T w; 00030 } __attribute__((aligned (16))); 00031 00032 template < typename T > 00033 struct gscalar 00034 { 00035 T x; 00036 00037 gscalar( const T& v ) 00038 : 00039 x(v) 00040 {} 00041 00042 gscalar& operator= ( const T& v ) 00043 { 00044 x= v; 00045 return *this; 00046 } 00047 00048 } __attribute__((aligned (4))); 00049 00050 typedef gscalar<bool> GLSLbool; 00051 typedef gvec2<bool> GLSLbvec2; 00052 typedef gvec3<bool> GLSLbvec3; 00053 typedef gvec4<bool> GLSLbvec4; 00054 00055 typedef gscalar<unsigned int> GLSLuint; 00056 typedef gvec2<unsigned int> GLSLuvec2; 00057 typedef gvec3<unsigned int> GLSLuvec3; 00058 typedef gvec4<unsigned int> GLSLuvec4; 00059 00060 typedef gscalar<int> GLSLint; 00061 typedef gvec2<int> GLSLivec2; 00062 typedef gvec3<int> GLSLivec3; 00063 typedef gvec4<int> GLSLivec4; 00064 00065 typedef gscalar<float> GLSLfloat; 00066 typedef gvec2<float> GLSLvec2; 00067 typedef gvec3<float> GLSLvec3; 00068 typedef gvec4<float> GLSLvec4; 00069 00070 } // namespace 00071 00072 #endif