00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00020 #ifndef SHNIBBLES_HPP
00021 #define SHNIBBLES_HPP
00022
00028 #include "ShBaseTexture.hpp"
00029 #include "ShProgram.hpp"
00030 #include "ShMatrix.hpp"
00031
00032 namespace SH {
00033
00038 template<typename T>
00039 ShProgram keep(const std::string & name = "");
00040
00045 template<typename T>
00046 ShProgram dup(const std::string & name = "var");
00047
00052 template<typename T>
00053 ShProgram lose(const std::string & name = "");
00054
00058 template<typename T>
00059 ShProgram access(const ShBaseTexture1D<T> &tex, const std::string & tcname = "texcoord", const std::string & name = "result");
00060
00064 template<typename T>
00065 ShProgram access(const ShBaseTexture2D<T> &tex, const std::string & tcname = "texcoord", const std::string & name = "result");
00066
00070 template<typename T>
00071 ShProgram access(const ShBaseTextureRect<T> &tex, const std::string & tcname = "texcoord", const std::string & name = "result");
00072
00076 template<typename T>
00077 ShProgram access(const ShBaseTexture3D<T> &tex, const std::string & tcname = "texcoord", const std::string & name = "result");
00078
00082 template<typename T>
00083 ShProgram access(const ShBaseTextureCube<T> &tex, const std::string & tcname = "texcoord", const std::string & name = "result");
00084
00091 template<typename T, int Rows, int Cols, ShBindingType Binding, typename T2>
00092 ShProgram transform(const ShMatrix<Rows, Cols, Binding, T2> &m, const std::string & name = "result");
00093
00102 template<typename T, typename T2>
00103 ShProgram cast(const std::string & name = "result");
00104
00113 template<typename T, typename T2>
00114 ShProgram fillcast(const std::string & name = "result");
00115
00120 template<typename T> ShProgram abs(const std::string & name = "result");
00121 template<typename T> ShProgram acos(const std::string & name = "result");
00122 template<typename T> ShProgram asin(const std::string & name = "result");
00123 template<typename T> ShProgram cos(const std::string & name = "result");
00124 template<typename T> ShProgram frac(const std::string & name = "result");
00125 template<typename T> ShProgram sin(const std::string & name = "result");
00126 template<typename T> ShProgram sqrt(const std::string & name = "result");
00127 template<typename T> ShProgram normalize(const std::string & name = "result");
00128 template<typename T> ShProgram pos(const std::string & name = "result");
00130
00136 #define SHNIBBLE_BINARY_OP_DECL(opname) \
00137 template<typename T1, typename T2> ShProgram opname(const std::string & output_name = "result",\
00138 const std::string & input_name0 = "x", const std::string & input_name1 = "y"); \
00139 template<typename T1> ShProgram opname(const std::string & output_name = "result",\
00140 const std::string & input_name0 = "x", const std::string & input_name1 = "y");
00141 SHNIBBLE_BINARY_OP_DECL(add);
00142 SHNIBBLE_BINARY_OP_DECL(sub);
00143 SHNIBBLE_BINARY_OP_DECL(mul);
00144 SHNIBBLE_BINARY_OP_DECL(div);
00145 SHNIBBLE_BINARY_OP_DECL(pow);
00146 SHNIBBLE_BINARY_OP_DECL(slt);
00147 SHNIBBLE_BINARY_OP_DECL(sle);
00148 SHNIBBLE_BINARY_OP_DECL(sgt);
00149 SHNIBBLE_BINARY_OP_DECL(sge);
00150 SHNIBBLE_BINARY_OP_DECL(seq);
00151 SHNIBBLE_BINARY_OP_DECL(sne);
00152 SHNIBBLE_BINARY_OP_DECL(max);
00153 SHNIBBLE_BINARY_OP_DECL(min);
00154 SHNIBBLE_BINARY_OP_DECL(mod);
00155
00161 template<typename T> ShProgram dot(const std::string & name = "result");
00163
00170 template<typename T1, typename T2>
00171 ShProgram lerp(const std::string & name = "result");
00172
00173 template<typename T1>
00174 ShProgram lerp(const std::string & name = "result");
00176
00177 }
00178
00179
00180 #include "ShNibblesImpl.hpp"
00181
00182 #endif