ShLibMatrix.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 #include "ShLib.hpp" // ShLibMatrix needs to be included from within ShLib
00021 
00022 #ifndef SHLIBMATRIX_HPP
00023 #define SHLIBMATRIX_HPP
00024 
00025 #include "ShGeneric.hpp"
00026 #include "ShMatrix.hpp"
00027 
00028 namespace SH {
00029 
00038 template<int M, int N, ShBindingType Binding, ShBindingType Binding2, typename T1, typename T2>
00039 ShMatrix<N, M, SH_TEMP, CT1T2>
00040 operator+(const ShMatrix<N, M, Binding, T1>& a, const ShMatrix<N, M, Binding2, T2>& b);
00041 
00045 template<int M, int N, ShBindingType Binding, ShBindingType Binding2, typename T1, typename T2>
00046 ShMatrix<N, M, SH_TEMP, CT1T2>
00047 operator-(const ShMatrix<N, M, Binding, T1>& a, const ShMatrix<N, M, Binding2, T2>& b);
00048 
00052 template<int M, int N, ShBindingType Binding, ShBindingType Binding2, typename T1, typename T2>
00053 ShMatrix<N, M, SH_TEMP, CT1T2>
00054 operator/(const ShMatrix<N, M, Binding, T1>& a, const ShMatrix<N, M, Binding2, T2>& b);
00055 
00059 template<int M, int N1, int N2, int P, ShBindingType Binding, ShBindingType Binding2, typename T1, typename T2>
00060 ShMatrix<M, P, SH_TEMP, CT1T2>
00061 operator|(const ShMatrix<M, N1, Binding, T1>& a,
00062           const ShMatrix<N2, P, Binding2, T2>& b);
00063 template<int M, int N1, int N2, int P, ShBindingType Binding, ShBindingType Binding2, typename T1, typename T2>
00064 ShMatrix<M, P, SH_TEMP, CT1T2>
00065 operator*(const ShMatrix<M, N1, Binding, T1>& a,
00066           const ShMatrix<N2, P, Binding2, T2>& b);
00067 
00071 template<int M, int N, ShBindingType Binding, typename T1, typename T2>
00072 ShGeneric<M, CT1T2> operator|(const ShMatrix<M, N, Binding, T1>& a, const ShGeneric<N, T2>& b);
00073 template<int M, int N, ShBindingType Binding, typename T1, typename T2>
00074 ShGeneric<M, CT1T2> operator*(const ShMatrix<M, N, Binding, T1>& a, const ShGeneric<N, T2>& b);
00075 // @}
00076 
00081 template<int M, int N, ShBindingType Binding1, ShBindingType Binding2, typename T1, typename T2, bool swizzled>
00082 ShAttrib<N-1, SH_TEMP, CT1T2, SH_VECTOR>
00083 operator|(const ShMatrix<M, N, Binding1, T1>& a, const ShAttrib<N-1, Binding2, T2, SH_VECTOR, swizzled>& b);
00084 template<int M, int N, ShBindingType Binding1, ShBindingType Binding2, typename T1, typename T2, bool swizzled>
00085 ShAttrib<N-1, SH_TEMP, CT1T2, SH_NORMAL>
00086 operator|(const ShMatrix<M, N, Binding1, T1>& a, const ShAttrib<N-1, Binding2, T2, SH_NORMAL, swizzled>& b);
00087 template<int M, int N, ShBindingType Binding1, ShBindingType Binding2, typename T1, typename T2, bool swizzled>
00088 ShAttrib<N-1, SH_TEMP, CT1T2, SH_VECTOR>
00089 operator*(const ShMatrix<M, N, Binding1, T1>& a, const ShAttrib<N-1, Binding2, T2, SH_VECTOR, swizzled>& b);
00090 template<int M, int N, ShBindingType Binding1, ShBindingType Binding2, typename T1, typename T2, bool swizzled>
00091 ShAttrib<N-1, SH_TEMP, CT1T2, SH_NORMAL>
00092 operator*(const ShMatrix<M, N, Binding1, T1>& a, const ShAttrib<N-1, Binding2, T2, SH_NORMAL, swizzled>& b);
00093 // @}
00094 
00099 template<int M, int N, ShBindingType Binding1, ShBindingType Binding2, typename T1, typename T2, bool swizzled>
00100 ShAttrib<N-1, SH_TEMP, CT1T2, SH_TEXCOORD>
00101 operator|(const ShMatrix<M, N, Binding1, T1>& a, const ShAttrib<N-1, Binding2, T2, SH_TEXCOORD, swizzled>& b);
00102 template<int M, int N, ShBindingType Binding1, ShBindingType Binding2, typename T1, typename T2, bool swizzled>
00103 ShAttrib<N-1, SH_TEMP, CT1T2, SH_POINT>
00104 operator|(const ShMatrix<M, N, Binding1, T1>& a, const ShAttrib<N-1, Binding2, T2, SH_POINT, swizzled>& b);
00105 template<int M, int N, ShBindingType Binding1, ShBindingType Binding2, typename T1, typename T2, bool swizzled>
00106 ShAttrib<N-1, SH_TEMP, CT1T2, SH_PLANE>
00107 operator|(const ShMatrix<M, N, Binding1, T1>& a, const ShAttrib<N-1, Binding2, T2, SH_PLANE, swizzled>& b);
00108 template<int M, int N, ShBindingType Binding1, ShBindingType Binding2, typename T1, typename T2, bool swizzled>
00109 ShAttrib<N-1, SH_TEMP, CT1T2, SH_TEXCOORD>
00110 operator*(const ShMatrix<M, N, Binding1, T1>& a, const ShAttrib<N-1, Binding2, T2, SH_TEXCOORD, swizzled>& b);
00111 template<int M, int N, ShBindingType Binding1, ShBindingType Binding2, typename T1, typename T2, bool swizzled>
00112 ShAttrib<N-1, SH_TEMP, CT1T2, SH_POINT>
00113 operator*(const ShMatrix<M, N, Binding1, T1>& a, const ShAttrib<N-1, Binding2, T2, SH_POINT, swizzled>& b);
00114 template<int M, int N, ShBindingType Binding1, ShBindingType Binding2, typename T1, typename T2, bool swizzled>
00115 ShAttrib<N-1, SH_TEMP, CT1T2, SH_PLANE>
00116 operator*(const ShMatrix<M, N, Binding1, T1>& a, const ShAttrib<N-1, Binding2, T2, SH_PLANE, swizzled>& b);
00117 // @}
00118 
00122 template<int M, int N, ShBindingType Binding, typename T1, typename T2>
00123 ShGeneric<N, CT1T2> operator|(const ShGeneric<M, T1>& a, const ShMatrix<M, N, Binding, T2>& b);
00124 template<int M, int N, ShBindingType Binding, typename T1, typename T2>
00125 ShGeneric<N, CT1T2> operator*(const ShGeneric<M, T1>& a, const ShMatrix<M, N, Binding, T2>& b);
00126 
00128 template<int M, int N, ShBindingType Binding, typename T1, typename T2>
00129 ShMatrix<M, N, SH_TEMP, CT1T2>
00130 operator*(const ShMatrix<M, N, Binding, T1>& a, const ShGeneric<1, T2>& b);
00131 
00132 template<int M, ShBindingType Binding, typename T1, typename T2>
00133 ShMatrix<M, 1, SH_TEMP, CT1T2>
00134 operator*(const ShMatrix<M, 1, Binding, T1>& a, const ShGeneric<1, T2>& b);
00135 
00137 template<int M, int N, ShBindingType Binding, typename T1, typename T2>
00138 ShMatrix<M, N, SH_TEMP, CT1T2>
00139 operator*(const ShGeneric<1, T1>& a, const ShMatrix<M, N, Binding, T2>& b);
00140 
00141 template<int N, ShBindingType Binding, typename T1, typename T2>
00142 ShMatrix<1, N, SH_TEMP, CT1T2>
00143 operator*(const ShGeneric<1, T1>& a, const ShMatrix<1, N, Binding, T2>& b);
00144 
00146 template<int M, int N, ShBindingType Binding, typename T1, typename T2>
00147 ShMatrix<M, N, SH_TEMP, CT1T2>
00148 operator/(const ShMatrix<M, N, Binding, T1>& a, const ShGeneric<1, T2>& b);
00149 
00153 template<ShBindingType Binding2, typename T2>
00154 ShAttrib1f det(const ShMatrix<1, 1, Binding2, T2>& matrix);
00155 
00156 template<ShBindingType Binding2, typename T2>
00157 ShAttrib1f det(const ShMatrix<2, 2, Binding2, T2>& matrix);
00158     
00159 template<int RowsCols, ShBindingType Binding2, typename T2>
00160 ShAttrib1f det(const ShMatrix<RowsCols, RowsCols, Binding2, T2>& matrix);
00161 
00162 
00166 template<int RowsCols, ShBindingType Binding2, typename T2>
00167 ShMatrix<RowsCols, RowsCols, SH_TEMP, T2>
00168 cofactors(const ShMatrix<RowsCols, RowsCols, Binding2, T2>& matrix);
00169     
00175 template<int M, int N, ShBindingType Binding2, typename T2>
00176 ShMatrix<N, M, SH_TEMP, T2>
00177 transpose(const ShMatrix<M, N, Binding2, T2>& matrix);
00178   
00182 template<int RowsCols, ShBindingType Binding2, typename T2>
00183 ShMatrix<RowsCols, RowsCols, SH_TEMP, T2>
00184 adjoint(const ShMatrix<RowsCols, RowsCols, Binding2, T2>& matrix);
00185 
00191 template<int RowsCols, ShBindingType Binding2, typename T2>
00192 ShMatrix<RowsCols,RowsCols, SH_TEMP, T2>
00193 inverse(const ShMatrix<RowsCols, RowsCols, Binding2, T2>& matrix);
00194 
00199 template<int RowsCols, ShBindingType Binding, typename T>
00200 ShGeneric<1, T>
00201 trace(const ShMatrix<RowsCols, RowsCols, Binding, T>& matrix);
00202 
00203 template<int N, typename T>
00204 ShMatrix<1, N, SH_TEMP, T>
00205 rowmat(const ShGeneric<N, T>& s0);
00206 
00207 template<int N, typename T1, typename T2>
00208 ShMatrix<2, N, SH_TEMP, CT1T2>
00209 rowmat(const ShGeneric<N, T1>& s0,
00210        const ShGeneric<N, T2>& s1);
00211 
00212 template<int N, typename T1, typename T2, typename T3>
00213 ShMatrix<3, N, SH_TEMP, CT1T2T3>
00214 rowmat(const ShGeneric<N, T1>& s0,
00215        const ShGeneric<N, T2>& s1,
00216        const ShGeneric<N, T3>& s2);
00217 
00218 template<int N, typename T1, typename T2, typename T3, typename T4>
00219 ShMatrix<4, N, SH_TEMP, CT1T2T3T4>
00220 rowmat(const ShGeneric<N, T1>& s0,
00221        const ShGeneric<N, T2>& s1,
00222        const ShGeneric<N, T3>& s2,
00223        const ShGeneric<N, T4>& s3);
00224 
00225 template<int N, typename T>
00226 ShMatrix<N, 1, SH_TEMP, T>
00227 colmat(const ShGeneric<N, T>& s0);
00228 
00229 template<int N, typename T>
00230 ShMatrix<N, 2, SH_TEMP, T>
00231 colmat(const ShGeneric<N, T>& s0,
00232        const ShGeneric<N, T>& s1);
00233 
00234 template<int N, typename T>
00235 ShMatrix<N, 3, SH_TEMP, T>
00236 colmat(const ShGeneric<N, T>& s0,
00237        const ShGeneric<N, T>& s1,
00238        const ShGeneric<N, T>& s2);
00239 
00240 template<int N, typename T>
00241 ShMatrix<N, 4, SH_TEMP, T>
00242 colmat(const ShGeneric<N, T>& s0,
00243        const ShGeneric<N, T>& s1,
00244        const ShGeneric<N, T>& s2,
00245        const ShGeneric<N, T>& s3);
00246 
00247 template<int N, typename T>
00248 ShMatrix<N, N, SH_TEMP, T>
00249 diag(const ShGeneric<N, T>& a);
00250 
00264 template<typename T>
00265 ShMatrix<4, 4, SH_TEMP, T>
00266 rotate(const ShGeneric<3, T>& axis, const ShGeneric<1, T>& angle);
00267 
00273 template<typename T>
00274 ShMatrix<3, 3, SH_TEMP, T>
00275 rotate(const ShGeneric<1, T>& angle);
00276 
00282 template<typename T>
00283 ShMatrix<4, 4, SH_TEMP, T>
00284 translate(const ShGeneric<3, T>& a);
00285 
00291 template<typename T>
00292 ShMatrix<3, 3, SH_TEMP, T>
00293 translate(const ShGeneric<2, T>& a);
00294 
00300 template<typename T>
00301 ShMatrix<4, 4, SH_TEMP, T>
00302 scale(const ShGeneric<3, T>& a);
00303 
00309 template<typename T>
00310 ShMatrix<3, 3, SH_TEMP, T>
00311 scale(const ShGeneric<2, T>& a);
00312 
00318 template<int N, typename T>
00319 ShMatrix<N, N, SH_TEMP, T>
00320 scale(const ShGeneric<1, T>& a);
00321 
00324 }
00325 
00326 #include "ShLibMatrixImpl.hpp"
00327 
00328 #endif

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