00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00020 #ifndef SHLIBNORMAL_HPP
00021 #define SHLIBNORMAL_HPP
00022
00023 #include "ShAttrib.hpp"
00024 #include "ShLib.hpp"
00025
00026 namespace SH {
00027
00028 SH_SHLIB_USUAL_NON_UNIT_OPS_RETTYPE(SH_NORMAL, SH_NORMAL);
00029
00030 template<int N, ShBindingType B1, typename T, bool S1>
00031 ShAttrib<N, SH_TEMP, T, SH_NORMAL, false>
00032 abs(const ShAttrib<N, B1, T, SH_NORMAL, S1>& var)
00033 {
00034 ShGeneric<N, T> t = abs(static_cast< ShGeneric<N, T> >(var));
00035 ShAttrib<N, SH_TEMP, T, SH_NORMAL, false> vec(t.node(), t.swizzle(), t.neg());
00036 return vec;
00037 }
00038
00039 template<int N, ShBindingType B1, typename T, bool S1>
00040 ShAttrib<N, SH_TEMP, T, SH_NORMAL, false>
00041 normalize(const ShAttrib<N, B1, T, SH_NORMAL, S1>& var)
00042 {
00043 ShGeneric<N, T> t = normalize(static_cast< ShGeneric<N, T> >(var));
00044 ShAttrib<N, SH_TEMP, T, SH_NORMAL, false> vec(t.node(), t.swizzle(), t.neg());
00045 return vec;
00046 }
00047
00048 SH_SHLIB_USUAL_SUBTRACT(SH_NORMAL);
00049
00050 SH_SHLIB_LEFT_MATRIX_OPERATION(SH_NORMAL, operator|, M);
00051
00052 template<int N, ShBindingType B1, ShBindingType B2, typename T, bool S1, bool S2>
00053 ShGeneric<1, T>
00054 operator|(const ShAttrib<N, B1, T, SH_NORMAL, S1>& a, const ShAttrib<N, B2, T, SH_NORMAL, S2>& b)
00055 {
00056 return dot(a, b);
00057 }
00058
00059 template<int N, ShBindingType B1, ShBindingType B2, typename T, bool S1, bool S2>
00060 ShGeneric<1, T>
00061 operator|(const ShAttrib<N, B1, T, SH_VECTOR, S1>& a, const ShAttrib<N, B2, T, SH_NORMAL, S2>& b)
00062 {
00063 return dot(a, b);
00064 }
00065
00066 template<int N, ShBindingType B1, ShBindingType B2, typename T, bool S1, bool S2>
00067 ShGeneric<1, T>
00068 operator|(const ShAttrib<N, B1, T, SH_NORMAL, S1>& a, const ShAttrib<N, B2, T, SH_VECTOR, S2>& b)
00069 {
00070 return dot(a, b);
00071 }
00072
00073 }
00074
00075 #endif