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 shAccess(const ShBaseTexture1D<T> &tex, const std::string & tcname = "texcoord", const std::string & name = "result");
00060
00064 template<typename T>
00065 ShProgram shAccess(const ShBaseTexture2D<T> &tex, const std::string & tcname = "texcoord", const std::string & name = "result");
00066
00070 template<typename T>
00071 ShProgram shAccess(const ShBaseTextureRect<T> &tex, const std::string & tcname = "texcoord", const std::string & name = "result");
00072
00076 template<typename T>
00077 ShProgram shAccess(const ShBaseTexture3D<T> &tex, const std::string & tcname = "texcoord", const std::string & name = "result");
00078
00082 template<typename T>
00083 ShProgram shAccess(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 shTransform(const ShMatrix<Rows, Cols, Binding, T2> &m, const std::string & name = "result");
00093
00102 template<typename T, typename T2>
00103 ShProgram shCast(const std::string & name = "result");
00104
00113 template<typename T, typename T2>
00114 ShProgram shFillcast(const std::string & name = "result");
00115
00120 template<typename T> ShProgram shAbs(const std::string & name = "result");
00121 template<typename T> ShProgram shAcos(const std::string & name = "result");
00122 template<typename T> ShProgram shAcosh(const std::string & name = "result");
00123 template<typename T> ShProgram shAsin(const std::string & name = "result");
00124 template<typename T> ShProgram shAsinh(const std::string & name = "result");
00125 template<typename T> ShProgram shAtan(const std::string & name = "result");
00126 template<typename T> ShProgram shAtanh(const std::string & name = "result");
00127 template<typename T> ShProgram shCbrt(const std::string & name = "result");
00128 template<typename T> ShProgram shCeil(const std::string & name = "result");
00129 template<typename T> ShProgram shCos(const std::string & name = "result");
00130 template<typename T> ShProgram shCosh(const std::string & name = "result");
00131 template<typename T> ShProgram shDx(const std::string & name = "result");
00132 template<typename T> ShProgram shDy(const std::string & name = "result");
00133 template<typename T> ShProgram shExp(const std::string & name = "result");
00134 template<typename T> ShProgram shExpm1(const std::string & name = "result");
00135 template<typename T> ShProgram shExp2(const std::string & name = "result");
00136 template<typename T> ShProgram shExp10(const std::string & name = "result");
00137 template<typename T> ShProgram shFloor(const std::string & name = "result");
00138 template<typename T> ShProgram shFrac(const std::string & name = "result");
00139 template<typename T> ShProgram shFwidth(const std::string & name = "result");
00140 template<typename T> ShProgram shLog(const std::string & name = "result");
00141 template<typename T> ShProgram shLogp1(const std::string & name = "result");
00142 template<typename T> ShProgram shLog2(const std::string & name = "result");
00143 template<typename T> ShProgram shLog10(const std::string & name = "result");
00144 template<typename T> ShProgram shNormalize(const std::string & name = "result");
00145 template<typename T> ShProgram shNot(const std::string & name = "result");
00146 template<typename T> ShProgram shPos(const std::string & name = "result");
00147 template<typename T> ShProgram shRcp(const std::string & name = "result");
00148 template<typename T> ShProgram shRound(const std::string & name = "result");
00149 template<typename T> ShProgram shRsqrt(const std::string & name = "result");
00150 template<typename T> ShProgram shSat(const std::string & name = "result");
00151 template<typename T> ShProgram shSign(const std::string & name = "result");
00152 template<typename T> ShProgram shSin(const std::string & name = "result");
00153 template<typename T> ShProgram shSinh(const std::string & name = "result");
00154 template<typename T> ShProgram shSort(const std::string & name = "result");
00155 template<typename T> ShProgram shSqrt(const std::string & name = "result");
00156 template<typename T> ShProgram shTan(const std::string & name = "result");
00157 template<typename T> ShProgram shTanh(const std::string & name = "result");
00159
00165 #define SHNIBBLE_BINARY_OP_DECL(opname) \
00166 template<typename T1, typename T2> ShProgram opname(const std::string & output_name = "result",\
00167 const std::string & input_name0 = "x", const std::string & input_name1 = "y"); \
00168 template<typename T1> ShProgram opname(const std::string & output_name = "result",\
00169 const std::string & input_name0 = "x", const std::string & input_name1 = "y")
00170
00171 SHNIBBLE_BINARY_OP_DECL(shAdd);
00172 SHNIBBLE_BINARY_OP_DECL(shAnd);
00173 SHNIBBLE_BINARY_OP_DECL(shAtan2);
00174 SHNIBBLE_BINARY_OP_DECL(shDiv);
00175 SHNIBBLE_BINARY_OP_DECL(shFaceforward);
00176 SHNIBBLE_BINARY_OP_DECL(shMax);
00177 SHNIBBLE_BINARY_OP_DECL(shMin);
00178 SHNIBBLE_BINARY_OP_DECL(shMod);
00179 SHNIBBLE_BINARY_OP_DECL(shMul);
00180 SHNIBBLE_BINARY_OP_DECL(shOr);
00181 SHNIBBLE_BINARY_OP_DECL(shPow);
00182 SHNIBBLE_BINARY_OP_DECL(shReflect);
00183 SHNIBBLE_BINARY_OP_DECL(shSeq);
00184 SHNIBBLE_BINARY_OP_DECL(shSge);
00185 SHNIBBLE_BINARY_OP_DECL(shSgt);
00186 SHNIBBLE_BINARY_OP_DECL(shSle);
00187 SHNIBBLE_BINARY_OP_DECL(shSlt);
00188 SHNIBBLE_BINARY_OP_DECL(shSne);
00189 SHNIBBLE_BINARY_OP_DECL(shSub);
00191
00198 #define SHNIBBLE_TERNARY_OP_DECL(opname) \
00199 template<typename T1, typename T2, typename T3> ShProgram opname(const std::string & output_name = "result",\
00200 const std::string & input_name0 = "x", const std::string & input_name1 = "y", \
00201 const std::string & input_name2 = "z"); \
00202 template<typename T1, typename T2> ShProgram opname(const std::string & output_name = "result",\
00203 const std::string & input_name0 = "x", const std::string & input_name1 = "y", \
00204 const std::string & input_name2 = "z"); \
00205 template<typename T1> ShProgram opname(const std::string & output_name = "result",\
00206 const std::string & input_name0 = "x", const std::string & input_name1 = "y", \
00207 const std::string & input_name2 = "z")
00208
00209 SHNIBBLE_TERNARY_OP_DECL(shClamp);
00210 SHNIBBLE_TERNARY_OP_DECL(shCond);
00211 SHNIBBLE_TERNARY_OP_DECL(shMad);
00212 SHNIBBLE_TERNARY_OP_DECL(shSmoothstep);
00214
00219 #define SHNIBBLE_HASH_FUNC_DECL(opname) \
00220 template<typename T1, typename T2> ShProgram opname(const std::string & output_name = "result",\
00221 const std::string & input_name0 = "x")
00222
00223 SHNIBBLE_HASH_FUNC_DECL(shCellnoise);
00224 SHNIBBLE_HASH_FUNC_DECL(shScellnoise);
00225 SHNIBBLE_HASH_FUNC_DECL(shHash);
00226 SHNIBBLE_HASH_FUNC_DECL(shTexhash);
00228
00234 #define SHNIBBLE_NOISE_FUNC_DECL(opname) \
00235 template<typename T1, typename T2> ShProgram opname(const std::string & output_name = "result",\
00236 const std::string & input_name0 = "x"); \
00237 template<typename T1, typename T2, typename T3> ShProgram opname(const std::string & output_name = "result",\
00238 const std::string & input_name0 = "x", const std::string & input_name1 = "y")
00239
00240 SHNIBBLE_NOISE_FUNC_DECL(shLinnoise);
00241 SHNIBBLE_NOISE_FUNC_DECL(shNoise);
00242 SHNIBBLE_NOISE_FUNC_DECL(shPerlin);
00243 SHNIBBLE_NOISE_FUNC_DECL(shTurbulence);
00244 SHNIBBLE_NOISE_FUNC_DECL(shSlinnoise);
00245 SHNIBBLE_NOISE_FUNC_DECL(shSnoise);
00246 SHNIBBLE_NOISE_FUNC_DECL(shSperlin);
00247 SHNIBBLE_NOISE_FUNC_DECL(shSturbulence);
00249
00255 #define SHNIBBLE_DISTANCE_FUNC_DECL(opname) \
00256 template<typename T1, typename T2> ShProgram opname(const std::string & output_name = "result",\
00257 const std::string & input_name0 = "x", const std::string & input_name1 = "y"); \
00258 template<typename T> ShProgram opname(const std::string & output_name = "result",\
00259 const std::string & input_name0 = "x", const std::string & input_name1 = "y")
00260
00261 SHNIBBLE_DISTANCE_FUNC_DECL(shDistance);
00262 SHNIBBLE_DISTANCE_FUNC_DECL(shDistance_1);
00263 SHNIBBLE_DISTANCE_FUNC_DECL(shDistance_inf);
00265
00270 #define SHNIBBLE_UNARY_TUPLEOP_DECL(opname) \
00271 template<typename T> ShProgram opname(const std::string & output_name = "result",\
00272 const std::string & input_name0 = "x")
00273
00274 SHNIBBLE_UNARY_TUPLEOP_DECL(shAll);
00275 SHNIBBLE_UNARY_TUPLEOP_DECL(shAny);
00276 SHNIBBLE_UNARY_TUPLEOP_DECL(shLength);
00277 SHNIBBLE_UNARY_TUPLEOP_DECL(shLength_1);
00278 SHNIBBLE_UNARY_TUPLEOP_DECL(shLength_inf);
00279 SHNIBBLE_UNARY_TUPLEOP_DECL(shMax1);
00280 SHNIBBLE_UNARY_TUPLEOP_DECL(shMin1);
00281 SHNIBBLE_UNARY_TUPLEOP_DECL(shProd);
00282 SHNIBBLE_UNARY_TUPLEOP_DECL(shSum);
00284
00289 template<int N, typename T>
00290 ShProgram shBernstein(const std::string& name = "result",
00291 const std::string& input_name0 = "x");
00292
00298 template<typename T1, typename T2>
00299 ShProgram shBezier(const std::string& name = "result",
00300 const std::string& input_name0 = "x",
00301 const std::string& input_name1 = "y");
00302
00308 template<typename T> ShProgram shCross(const std::string & name = "result",
00309 const std::string & input_name0 = "x",
00310 const std::string & input_name1 = "y");
00311
00316 template<typename T> ShProgram shDiscard(const std::string & name = "result",
00317 const std::string & input_name0 = "x");
00318
00324 template<typename T> ShProgram shDot(const std::string & name = "result",
00325 const std::string & input_name0 = "x",
00326 const std::string & input_name1 = "y");
00327
00332 template<typename T> ShProgram shGradient(const std::string & name = "result",
00333 const std::string & input_name0 = "x");
00334
00339 template<int S, typename T>
00340 ShProgram shGroupsort(const std::string & name = "result",
00341 const std::string & input_name0 = "x");
00342
00351 template<typename T1, typename T2>
00352 ShProgram shHermite(const std::string& name = "result",
00353 const std::string& input_name0 = "x",
00354 const std::string& input_name1 = "y",
00355 const std::string& input_name2 = "z",
00356 const std::string& input_name3 = "w",
00357 const std::string& input_name4 = "v");
00358
00364 template<typename T1, typename T2>
00365 ShProgram shJoin(const std::string & name = "result",
00366 const std::string & input_name0 = "x",
00367 const std::string & input_name1 = "y");
00368
00375 template<typename T1, typename T2>
00376 ShProgram shLerp(const std::string & name = "result",
00377 const std::string & input_name0 = "x",
00378 const std::string & input_name1 = "y",
00379 const std::string & input_name2 = "z");
00380
00381 template<typename T1>
00382 ShProgram shLerp(const std::string & name = "result",
00383 const std::string & input_name0 = "x",
00384 const std::string & input_name1 = "y",
00385 const std::string & input_name2 = "z");
00387
00394 template<typename T>
00395 ShProgram shLit(const std::string& name = "result",
00396 const std::string& input_name0 = "x",
00397 const std::string& input_name1 = "y",
00398 const std::string& input_name2 = "z");
00399
00406 template<typename T1, typename T2>
00407 ShProgram shPoly(const std::string & name = "result",
00408 const std::string & input_name0 = "x",
00409 const std::string & input_name1 = "y");
00410
00411 template<typename T1>
00412 ShProgram shPoly(const std::string & name = "result",
00413 const std::string & input_name0 = "x",
00414 const std::string & input_name1 = "y");
00416
00423 template<typename T1, typename T2>
00424 ShProgram shRefract(const std::string& name = "result",
00425 const std::string& input_name0 = "x",
00426 const std::string& input_name1 = "y",
00427 const std::string& input_name2 = "z");
00428
00429 template<typename T>
00430 ShProgram shRefract(const std::string& name = "result",
00431 const std::string& input_name0 = "x",
00432 const std::string& input_name1 = "y",
00433 const std::string& input_name2 = "z");
00435
00442 template<typename T>
00443 ShProgram shSmoothpulse(const std::string& name = "result",
00444 const std::string& input_name0 = "x",
00445 const std::string& input_name1 = "y",
00446 const std::string& input_name2 = "z",
00447 const std::string& input_name3 = "w");
00448
00449 }
00450
00451 #include "ShNibblesImpl.hpp"
00452
00453 #endif // SHNIBBLES_HPP