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
00027 #ifndef SHBASETEXTURE_HPP
00028 #define SHBASETEXTURE_HPP
00029
00030 #include <string>
00031 #include "ShDllExport.hpp"
00032 #include "ShTextureNode.hpp"
00033 #include "ShMemory.hpp"
00034 #include "ShVariable.hpp"
00035 #include "ShAttrib.hpp"
00036 #include "ShMetaForwarder.hpp"
00037
00038 namespace SH {
00039
00040 class
00041 SH_DLLEXPORT ShBaseTexture : public ShMetaForwarder {
00042 public:
00043 ShBaseTexture(const ShTextureNodePtr& node);
00044
00045 protected:
00046 ShTextureNodePtr m_node;
00047 };
00048
00051 template<typename T>
00052 class ShBaseTexture1D : public ShBaseTexture {
00053 public:
00054 ShBaseTexture1D(const ShTextureTraits& traits);
00055 ShBaseTexture1D(int width, const ShTextureTraits& traits);
00056
00057 template<typename T2>
00058 T operator()(const ShGeneric<1, T2>& coords) const;
00059
00060 template<typename T2>
00061 T operator[](const ShGeneric<1, T2>& coords) const;
00062
00063 ShMemoryPtr memory();
00064 void memory(ShMemoryPtr memory);
00065 void size(int width);
00066
00067 ShAttrib1f size() const;
00068 int width() { return m_node->width(); }
00069
00070 typedef T return_type;
00071 };
00072
00075 template<typename T>
00076 class ShBaseTexture2D : public ShBaseTexture {
00077 public:
00078 ShBaseTexture2D(const ShTextureTraits& traits);
00079 ShBaseTexture2D(int width, int height, const ShTextureTraits& traits);
00080
00081 template<typename T2>
00082 T operator()(const ShGeneric<2, T2>& coords) const;
00083
00085 template<typename T2, typename T3, typename T4>
00086 T operator()(const ShGeneric<2, T2>& coords,
00087 const ShGeneric<2, T3>& dx,
00088 const ShGeneric<2, T4>& dy) const;
00089
00090 template<typename T2>
00091 T operator[](const ShGeneric<2, T2>& coords) const;
00092
00093 ShMemoryPtr memory();
00094 void memory(ShMemoryPtr memory);
00095 void size(int width, int height);
00096
00097 ShAttrib2f size() const;
00098
00099 int width() { return m_node->width(); }
00100 int height() { return m_node->height(); }
00101
00102 typedef T return_type;
00103 };
00104
00107 template<typename T>
00108 class ShBaseTextureRect : public ShBaseTexture {
00109 public:
00110 ShBaseTextureRect(const ShTextureTraits& traits);
00111 ShBaseTextureRect(int width, int height, const ShTextureTraits& traits);
00112
00113 template<typename T2>
00114 T operator()(const ShGeneric<2, T2>& coords) const;
00115
00116 template<typename T2>
00117 T operator[](const ShGeneric<2, T2>& coords) const;
00118
00119 ShMemoryPtr memory();
00120 void memory(ShMemoryPtr memory);
00121 void size(int width, int height);
00122
00123 ShAttrib2f size() const;
00124
00125 int width() { return m_node->width(); }
00126 int height() { return m_node->height(); }
00127
00128 typedef T return_type;
00129 };
00130
00133 template<typename T>
00134 class ShBaseTexture3D : public ShBaseTexture {
00135 public:
00136 ShBaseTexture3D(const ShTextureTraits& traits);
00137 ShBaseTexture3D(int width, int height, int depth, const ShTextureTraits& traits);
00138
00139 template<typename T2>
00140 T operator()(const ShGeneric<3, T2>& coords) const;
00141
00142 template<typename T2>
00143 T operator[](const ShGeneric<3, T2>& coords) const;
00144
00145 ShMemoryPtr memory();
00146 void memory(ShMemoryPtr memory);
00147 void size(int width, int height, int depth);
00148
00149 ShAttrib3f size() const;
00150 int width() { return m_node->width(); }
00151 int height() { return m_node->height(); }
00152 int depth() { return m_node->depth(); }
00153
00154 typedef T return_type;
00155 };
00156
00159 template<typename T>
00160 class ShBaseTextureCube : public ShBaseTexture {
00161 public:
00162 ShBaseTextureCube(const ShTextureTraits& traits);
00163 ShBaseTextureCube(int width, int height, const ShTextureTraits& traits);
00164
00165 template<typename T2>
00166 T operator()(const ShGeneric<3, T2>& coords) const;
00167
00168 ShMemoryPtr memory(ShCubeDirection face);
00169 void memory(ShMemoryPtr memory, ShCubeDirection face);
00170 void size(int width, int height);
00171
00172 ShAttrib2f size() const;
00173
00174 int width() { return m_node->width(); }
00175 int height() { return m_node->height(); }
00176
00177 typedef T return_type;
00178 };
00179
00180 }
00181
00182 #include "ShBaseTextureImpl.hpp"
00183
00184 #endif