ShArray.hpp

00001 // Sh: A GPU metaprogramming language.
00002 //
00003 // Copyright 2003-2006 Serious Hack Inc.
00004 // 
00005 // This library is free software; you can redistribute it and/or
00006 // modify it under the terms of the GNU Lesser General Public
00007 // License as published by the Free Software Foundation; either
00008 // version 2.1 of the License, or (at your option) any later version.
00009 //
00010 // This library is distributed in the hope that it will be useful,
00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013 // Lesser General Public License for more details.
00014 //
00015 // You should have received a copy of the GNU Lesser General Public
00016 // License along with this library; if not, write to the Free Software
00017 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
00018 // MA  02110-1301, USA
00020 #ifndef SHARRAY_HPP
00021 #define SHARRAY_HPP
00022 
00023 namespace SH {
00024 
00025 template<typename T> class ShBaseTexture1D;
00026 template<typename T> class ShBaseTexture2D;
00027 template<typename T> class ShBaseTexture3D;
00028 template<typename T> class ShBaseTextureRect;
00029 template<typename T> class ShBaseTextureCube;
00030   
00034 struct
00035 ShArrayTraits : public ShTextureTraits {
00036   ShArrayTraits()
00037     : ShTextureTraits(0, SH_FILTER_NONE, SH_WRAP_CLAMP_TO_EDGE)
00038   {}
00039 };
00040 
00041 template<typename T> class ShArrayRect;
00044 template<typename T>
00045 class ShArray1D
00046   : public ShBaseTexture1D<T> {
00047 public:
00048   ShArray1D()
00049     : ShBaseTexture1D<T>(ShArrayTraits())
00050   {}
00051   ShArray1D(int width)
00052     : ShBaseTexture1D<T>(width, ShArrayTraits())
00053   {}
00054   typedef ShArrayRect<T> rectangular_type;
00055   typedef ShBaseTexture1D<T> base_type;
00056   typedef T return_type;
00057 };
00058 
00061 template<typename T>
00062 class ShArray2D
00063   : public ShBaseTexture2D<T> {
00064 public:
00065   ShArray2D()
00066     : ShBaseTexture2D<T>(ShArrayTraits())
00067   {}
00068   ShArray2D(int width, int height)
00069     : ShBaseTexture2D<T>(width, height, ShArrayTraits())
00070   {}
00071   typedef ShArrayRect<T> rectangular_type;
00072   typedef ShBaseTexture2D<T> base_type;
00073   typedef T return_type;
00074 };
00075 
00078 template<typename T>
00079 class ShArrayRect
00080   : public ShBaseTextureRect<T> {
00081 public:
00082   ShArrayRect()
00083     : ShBaseTextureRect<T>(ShArrayTraits())
00084   {}
00085   ShArrayRect(int width, int height)
00086     : ShBaseTextureRect<T>(width, height, ShArrayTraits())
00087   {}
00088   typedef ShArrayRect<T> rectangular_type;
00089   typedef ShBaseTextureRect<T> base_type;
00090   typedef T return_type;
00091 };
00092 
00095 template<typename T>
00096 class ShArray3D
00097   : public ShBaseTexture3D<T> {
00098 public:
00099   ShArray3D()
00100     : ShBaseTexture3D<T>(ShArrayTraits())
00101   {}
00102   ShArray3D(int width, int height, int depth)
00103     : ShBaseTexture3D<T>(width, height, depth, ShArrayTraits())
00104   {}
00105   typedef ShArrayRect<T> rectangular_type;
00106   typedef ShBaseTexture3D<T> base_type;
00107   typedef T return_type;
00108 };
00109 
00114 template<typename T>
00115 class ShArrayCube
00116   : public ShBaseTextureCube<T> {
00117 public:
00118   ShArrayCube()
00119     : ShBaseTextureCube<T>(ShArrayTraits())
00120   {}
00121   ShArrayCube(int width, int height)
00122     : ShBaseTextureCube<T>(width, height, ShArrayTraits())
00123   {}
00124   typedef ShArrayRect<T> rectangular_type;
00125   typedef ShBaseTextureCube<T> base_type;
00126   typedef T return_type;
00127 };
00128 
00129 }
00130 
00131 #endif

Generated on Thu Feb 16 14:51:29 2006 for Sh by  doxygen 1.4.6