Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

ShAttribImpl.hpp

00001 // WARNING - DO NOT EDIT THIS FILE: 00002 // This file was automatically generated from scripts/ShAttribImpl.hpp.py. 00003 // If you wish to change it, edit that file instead. 00004 // 00005 // --- 00006 // 00007 // Sh: A GPU metaprogramming language. 00008 // 00009 // Copyright (c) 2003 University of Waterloo Computer Graphics Laboratory 00010 // Project administrator: Michael D. McCool 00011 // Authors: Zheng Qin, Stefanus Du Toit, Kevin Moule, Tiberiu S. Popa, 00012 // Michael D. McCool 00013 // 00014 // This software is provided 'as-is', without any express or implied 00015 // warranty. In no event will the authors be held liable for any damages 00016 // arising from the use of this software. 00017 // 00018 // Permission is granted to anyone to use this software for any purpose, 00019 // including commercial applications, and to alter it and redistribute it 00020 // freely, subject to the following restrictions: 00021 // 00022 // 1. The origin of this software must not be misrepresented; you must 00023 // not claim that you wrote the original software. If you use this 00024 // software in a product, an acknowledgment in the product documentation 00025 // would be appreciated but is not required. 00026 // 00027 // 2. Altered source versions must be plainly marked as such, and must 00028 // not be misrepresented as being the original software. 00029 // 00030 // 3. This notice may not be removed or altered from any source 00031 // distribution. 00033 00034 #ifndef SH_SHATTRIBIMPL_HPP 00035 #define SH_SHATTRIBIMPL_HPP 00036 00037 #include "ShAttrib.hpp" 00038 #include "ShStatement.hpp" 00039 #include "ShEnvironment.hpp" 00040 #include "ShDebug.hpp" 00041 00042 namespace SH { 00043 00044 template<int N, ShBindingType Binding, typename T, bool Swizzled> 00045 inline 00046 ShAttrib<N, Binding, T, Swizzled>::ShAttrib() 00047 : ShGeneric<N, T>(new ShVariableNode(Binding, N)) 00048 { 00049 } 00050 00051 template<int N, ShBindingType Binding, typename T, bool Swizzled> 00052 inline 00053 ShAttrib<N, Binding, T, Swizzled>::ShAttrib(const ShGeneric<N, T>& other) 00054 : ShGeneric<N, T>(new ShVariableNode(Binding, N)) 00055 { 00056 shASN(*this, other); 00057 } 00058 00059 template<int N, ShBindingType Binding, typename T, bool Swizzled> 00060 inline 00061 ShAttrib<N, Binding, T, Swizzled>::ShAttrib(const ShAttrib<N, Binding, T, Swizzled>& other) 00062 : ShGeneric<N, T>(new ShVariableNode(Binding, N)) 00063 { 00064 shASN(*this, other); 00065 } 00066 00067 template<int N, ShBindingType Binding, typename T, bool Swizzled> 00068 inline 00069 ShAttrib<N, Binding, T, Swizzled>::ShAttrib(const ShVariableNodePtr& node, 00070 const ShSwizzle& swizzle, bool neg) 00071 : ShGeneric<N, T>(node, swizzle, neg) 00072 { 00073 } 00074 00075 template<int N, ShBindingType Binding, typename T, bool Swizzled> 00076 inline 00077 ShAttrib<N, Binding, T, Swizzled>::ShAttrib(T data[N]) 00078 : ShGeneric<N, T>(new ShVariableNode(Binding, N)) 00079 { 00080 if (Binding == SH_CONST) { 00081 for (int i = 0; i < N; i++) m_node->setValue(i, data[i]); 00082 } else { 00083 (*this) = ShAttrib<N, SH_CONST, T>(data); 00084 } 00085 } 00086 00087 template<int N, ShBindingType Binding, typename T, bool Swizzled> 00088 inline 00089 ShAttrib<N, Binding, T, Swizzled>::~ShAttrib() 00090 { 00091 } 00092 00093 template<int N, ShBindingType Binding, typename T, bool Swizzled> 00094 inline 00095 ShAttrib<N, Binding, T, Swizzled>& 00096 ShAttrib<N, Binding, T, Swizzled>::operator=(const ShGeneric<N, T>& other) 00097 { 00098 ParentType::operator=(other); 00099 return *this; 00100 } 00101 00102 template<int N, ShBindingType Binding, typename T, bool Swizzled> 00103 inline 00104 ShAttrib<N, Binding, T, Swizzled>& 00105 ShAttrib<N, Binding, T, Swizzled>::operator=(const ShAttrib<N, Binding, T, Swizzled>& other) 00106 { 00107 ParentType::operator=(other); 00108 return *this; 00109 } 00110 00111 template<int N, ShBindingType Binding, typename T, bool Swizzled> 00112 inline 00113 ShAttrib<N, Binding, T, Swizzled>& 00114 ShAttrib<N, Binding, T, Swizzled>::operator=(const ShProgram& prg) 00115 { 00116 ParentType::operator=(prg); 00117 return *this; 00118 } 00119 00120 template<int N, ShBindingType Binding, typename T, bool Swizzled> 00121 inline 00122 ShAttrib<N, Binding, T, Swizzled>& 00123 ShAttrib<N, Binding, T, Swizzled>::operator+=(const ShGeneric<N, T>& right) 00124 { 00125 ParentType::operator+=(right); 00126 return *this; 00127 } 00128 00129 template<int N, ShBindingType Binding, typename T, bool Swizzled> 00130 inline 00131 ShAttrib<N, Binding, T, Swizzled>& 00132 ShAttrib<N, Binding, T, Swizzled>::operator-=(const ShGeneric<N, T>& right) 00133 { 00134 ParentType::operator-=(right); 00135 return *this; 00136 } 00137 00138 template<int N, ShBindingType Binding, typename T, bool Swizzled> 00139 inline 00140 ShAttrib<N, Binding, T, Swizzled>& 00141 ShAttrib<N, Binding, T, Swizzled>::operator*=(const ShGeneric<N, T>& right) 00142 { 00143 ParentType::operator*=(right); 00144 return *this; 00145 } 00146 00147 template<int N, ShBindingType Binding, typename T, bool Swizzled> 00148 inline 00149 ShAttrib<N, Binding, T, Swizzled>& 00150 ShAttrib<N, Binding, T, Swizzled>::operator/=(const ShGeneric<N, T>& right) 00151 { 00152 ParentType::operator/=(right); 00153 return *this; 00154 } 00155 00156 template<int N, ShBindingType Binding, typename T, bool Swizzled> 00157 inline 00158 ShAttrib<N, Binding, T, Swizzled>& 00159 ShAttrib<N, Binding, T, Swizzled>::operator%=(const ShGeneric<N, T>& right) 00160 { 00161 ParentType::operator%=(right); 00162 return *this; 00163 } 00164 00165 template<int N, ShBindingType Binding, typename T, bool Swizzled> 00166 inline 00167 ShAttrib<N, Binding, T, Swizzled>& 00168 ShAttrib<N, Binding, T, Swizzled>::operator+=(T right) 00169 { 00170 ParentType::operator+=(right); 00171 return *this; 00172 } 00173 00174 template<int N, ShBindingType Binding, typename T, bool Swizzled> 00175 inline 00176 ShAttrib<N, Binding, T, Swizzled>& 00177 ShAttrib<N, Binding, T, Swizzled>::operator-=(T right) 00178 { 00179 ParentType::operator-=(right); 00180 return *this; 00181 } 00182 00183 template<int N, ShBindingType Binding, typename T, bool Swizzled> 00184 inline 00185 ShAttrib<N, Binding, T, Swizzled>& 00186 ShAttrib<N, Binding, T, Swizzled>::operator*=(T right) 00187 { 00188 ParentType::operator*=(right); 00189 return *this; 00190 } 00191 00192 template<int N, ShBindingType Binding, typename T, bool Swizzled> 00193 inline 00194 ShAttrib<N, Binding, T, Swizzled>& 00195 ShAttrib<N, Binding, T, Swizzled>::operator/=(T right) 00196 { 00197 ParentType::operator/=(right); 00198 return *this; 00199 } 00200 00201 template<int N, ShBindingType Binding, typename T, bool Swizzled> 00202 inline 00203 ShAttrib<N, Binding, T, Swizzled>& 00204 ShAttrib<N, Binding, T, Swizzled>::operator%=(T right) 00205 { 00206 ParentType::operator%=(right); 00207 return *this; 00208 } 00209 00210 template<int N, ShBindingType Binding, typename T, bool Swizzled> 00211 inline 00212 ShAttrib<N, Binding, T, Swizzled>& 00213 ShAttrib<N, Binding, T, Swizzled>::operator+=(const ShGeneric<1, T>& right) 00214 { 00215 ParentType::operator+=(right); 00216 return *this; 00217 } 00218 00219 template<int N, ShBindingType Binding, typename T, bool Swizzled> 00220 inline 00221 ShAttrib<N, Binding, T, Swizzled>& 00222 ShAttrib<N, Binding, T, Swizzled>::operator-=(const ShGeneric<1, T>& right) 00223 { 00224 ParentType::operator-=(right); 00225 return *this; 00226 } 00227 00228 template<int N, ShBindingType Binding, typename T, bool Swizzled> 00229 inline 00230 ShAttrib<N, Binding, T, Swizzled>& 00231 ShAttrib<N, Binding, T, Swizzled>::operator*=(const ShGeneric<1, T>& right) 00232 { 00233 ParentType::operator*=(right); 00234 return *this; 00235 } 00236 00237 template<int N, ShBindingType Binding, typename T, bool Swizzled> 00238 inline 00239 ShAttrib<N, Binding, T, Swizzled>& 00240 ShAttrib<N, Binding, T, Swizzled>::operator/=(const ShGeneric<1, T>& right) 00241 { 00242 ParentType::operator/=(right); 00243 return *this; 00244 } 00245 00246 template<int N, ShBindingType Binding, typename T, bool Swizzled> 00247 inline 00248 ShAttrib<N, Binding, T, Swizzled>& 00249 ShAttrib<N, Binding, T, Swizzled>::operator%=(const ShGeneric<1, T>& right) 00250 { 00251 ParentType::operator%=(right); 00252 return *this; 00253 } 00254 00255 template<int N, ShBindingType Binding, typename T, bool Swizzled> 00256 inline 00257 ShAttrib<1, Binding, T, true> 00258 ShAttrib<N, Binding, T, Swizzled>::operator()(int s0) const 00259 { 00260 return ShAttrib<1, Binding, T, true>(m_node, m_swizzle * ShSwizzle(N, s0), m_neg); 00261 } 00262 00263 template<int N, ShBindingType Binding, typename T, bool Swizzled> 00264 inline 00265 ShAttrib<2, Binding, T, true> 00266 ShAttrib<N, Binding, T, Swizzled>::operator()(int s0, int s1) const 00267 { 00268 return ShAttrib<2, Binding, T, true>(m_node, m_swizzle * ShSwizzle(N, s0, s1), m_neg); 00269 } 00270 00271 template<int N, ShBindingType Binding, typename T, bool Swizzled> 00272 inline 00273 ShAttrib<3, Binding, T, true> 00274 ShAttrib<N, Binding, T, Swizzled>::operator()(int s0, int s1, int s2) const 00275 { 00276 return ShAttrib<3, Binding, T, true>(m_node, m_swizzle * ShSwizzle(N, s0, s1, s2), m_neg); 00277 } 00278 00279 template<int N, ShBindingType Binding, typename T, bool Swizzled> 00280 inline 00281 ShAttrib<4, Binding, T, true> 00282 ShAttrib<N, Binding, T, Swizzled>::operator()(int s0, int s1, int s2, int s3) const 00283 { 00284 return ShAttrib<4, Binding, T, true>(m_node, m_swizzle * ShSwizzle(N, s0, s1, s2, s3), m_neg); 00285 } 00286 00287 template<int N, ShBindingType Binding, typename T, bool Swizzled> 00288 template<int N2> 00289 ShAttrib<N2, Binding, T, true> 00290 ShAttrib<N, Binding, T, Swizzled>::swiz(int indices[]) const 00291 { 00292 return ShAttrib<N2, Binding, T, true>(m_node, m_swizzle * ShSwizzle(N, N2, indices), m_neg); 00293 } 00294 00295 template<int N, ShBindingType Binding, typename T, bool Swizzled> 00296 inline 00297 ShAttrib<1, Binding, T, true> 00298 ShAttrib<N, Binding, T, Swizzled>::operator[](int s0) const 00299 { 00300 return ShAttrib<1, Binding, T, true>(m_node, m_swizzle * ShSwizzle(N, s0), m_neg); 00301 } 00302 00303 template<int N, ShBindingType Binding, typename T, bool Swizzled> 00304 ShAttrib<N, Binding, T, Swizzled> 00305 ShAttrib<N, Binding, T, Swizzled>::operator-() const 00306 { 00307 return ShAttrib<N, Binding, T, Swizzled>(m_node, m_swizzle, !m_neg); 00308 } 00309 00310 template<ShBindingType Binding, typename T, bool Swizzled> 00311 inline 00312 ShAttrib<1, Binding, T, Swizzled>::ShAttrib() 00313 : ShGeneric<1, T>(new ShVariableNode(Binding, 1)) 00314 { 00315 } 00316 00317 template<ShBindingType Binding, typename T, bool Swizzled> 00318 inline 00319 ShAttrib<1, Binding, T, Swizzled>::ShAttrib(const ShGeneric<1, T>& other) 00320 : ShGeneric<1, T>(new ShVariableNode(Binding, 1)) 00321 { 00322 shASN(*this, other); 00323 } 00324 00325 template<ShBindingType Binding, typename T, bool Swizzled> 00326 inline 00327 ShAttrib<1, Binding, T, Swizzled>::ShAttrib(const ShAttrib<1, Binding, T, Swizzled>& other) 00328 : ShGeneric<1, T>(new ShVariableNode(Binding, 1)) 00329 { 00330 shASN(*this, other); 00331 } 00332 00333 template<ShBindingType Binding, typename T, bool Swizzled> 00334 inline 00335 ShAttrib<1, Binding, T, Swizzled>::ShAttrib(const ShVariableNodePtr& node, 00336 const ShSwizzle& swizzle, bool neg) 00337 : ShGeneric<1, T>(node, swizzle, neg) 00338 { 00339 } 00340 00341 template<ShBindingType Binding, typename T, bool Swizzled> 00342 inline 00343 ShAttrib<1, Binding, T, Swizzled>::ShAttrib(T data[1]) 00344 : ShGeneric<1, T>(new ShVariableNode(Binding, 1)) 00345 { 00346 if (Binding == SH_CONST) { 00347 for (int i = 0; i < 1; i++) m_node->setValue(i, data[i]); 00348 } else { 00349 (*this) = ShAttrib<1, SH_CONST, T>(data); 00350 } 00351 } 00352 00353 template<ShBindingType Binding, typename T, bool Swizzled> 00354 inline 00355 ShAttrib<1, Binding, T, Swizzled>::ShAttrib(T s0) 00356 : ShGeneric<1, T>(new ShVariableNode(Binding, 1)) 00357 { 00358 if (Binding == SH_CONST) { 00359 m_node->setValue(0, s0); 00360 } else { 00361 (*this)[0] = ShAttrib<1, SH_CONST, T>(s0); 00362 } 00363 } 00364 00365 template<ShBindingType Binding, typename T, bool Swizzled> 00366 inline 00367 ShAttrib<1, Binding, T, Swizzled>::~ShAttrib() 00368 { 00369 } 00370 00371 template<ShBindingType Binding, typename T, bool Swizzled> 00372 inline 00373 ShAttrib<1, Binding, T, Swizzled>& 00374 ShAttrib<1, Binding, T, Swizzled>::operator=(const ShGeneric<1, T>& other) 00375 { 00376 ParentType::operator=(other); 00377 return *this; 00378 } 00379 00380 template<ShBindingType Binding, typename T, bool Swizzled> 00381 inline 00382 ShAttrib<1, Binding, T, Swizzled>& 00383 ShAttrib<1, Binding, T, Swizzled>::operator=(const ShAttrib<1, Binding, T, Swizzled>& other) 00384 { 00385 ParentType::operator=(other); 00386 return *this; 00387 } 00388 00389 template<ShBindingType Binding, typename T, bool Swizzled> 00390 inline 00391 ShAttrib<1, Binding, T, Swizzled>& 00392 ShAttrib<1, Binding, T, Swizzled>::operator=(T other) 00393 { 00394 ParentType::operator=(other); 00395 return *this; 00396 } 00397 00398 template<ShBindingType Binding, typename T, bool Swizzled> 00399 inline 00400 ShAttrib<1, Binding, T, Swizzled>& 00401 ShAttrib<1, Binding, T, Swizzled>::operator=(const ShProgram& prg) 00402 { 00403 ParentType::operator=(prg); 00404 return *this; 00405 } 00406 00407 template<ShBindingType Binding, typename T, bool Swizzled> 00408 inline 00409 ShAttrib<1, Binding, T, Swizzled>& 00410 ShAttrib<1, Binding, T, Swizzled>::operator+=(const ShGeneric<1, T>& right) 00411 { 00412 ParentType::operator+=(right); 00413 return *this; 00414 } 00415 00416 template<ShBindingType Binding, typename T, bool Swizzled> 00417 inline 00418 ShAttrib<1, Binding, T, Swizzled>& 00419 ShAttrib<1, Binding, T, Swizzled>::operator-=(const ShGeneric<1, T>& right) 00420 { 00421 ParentType::operator-=(right); 00422 return *this; 00423 } 00424 00425 template<ShBindingType Binding, typename T, bool Swizzled> 00426 inline 00427 ShAttrib<1, Binding, T, Swizzled>& 00428 ShAttrib<1, Binding, T, Swizzled>::operator*=(const ShGeneric<1, T>& right) 00429 { 00430 ParentType::operator*=(right); 00431 return *this; 00432 } 00433 00434 template<ShBindingType Binding, typename T, bool Swizzled> 00435 inline 00436 ShAttrib<1, Binding, T, Swizzled>& 00437 ShAttrib<1, Binding, T, Swizzled>::operator/=(const ShGeneric<1, T>& right) 00438 { 00439 ParentType::operator/=(right); 00440 return *this; 00441 } 00442 00443 template<ShBindingType Binding, typename T, bool Swizzled> 00444 inline 00445 ShAttrib<1, Binding, T, Swizzled>& 00446 ShAttrib<1, Binding, T, Swizzled>::operator%=(const ShGeneric<1, T>& right) 00447 { 00448 ParentType::operator%=(right); 00449 return *this; 00450 } 00451 00452 template<ShBindingType Binding, typename T, bool Swizzled> 00453 inline 00454 ShAttrib<1, Binding, T, Swizzled>& 00455 ShAttrib<1, Binding, T, Swizzled>::operator+=(T right) 00456 { 00457 ParentType::operator+=(right); 00458 return *this; 00459 } 00460 00461 template<ShBindingType Binding, typename T, bool Swizzled> 00462 inline 00463 ShAttrib<1, Binding, T, Swizzled>& 00464 ShAttrib<1, Binding, T, Swizzled>::operator-=(T right) 00465 { 00466 ParentType::operator-=(right); 00467 return *this; 00468 } 00469 00470 template<ShBindingType Binding, typename T, bool Swizzled> 00471 inline 00472 ShAttrib<1, Binding, T, Swizzled>& 00473 ShAttrib<1, Binding, T, Swizzled>::operator*=(T right) 00474 { 00475 ParentType::operator*=(right); 00476 return *this; 00477 } 00478 00479 template<ShBindingType Binding, typename T, bool Swizzled> 00480 inline 00481 ShAttrib<1, Binding, T, Swizzled>& 00482 ShAttrib<1, Binding, T, Swizzled>::operator/=(T right) 00483 { 00484 ParentType::operator/=(right); 00485 return *this; 00486 } 00487 00488 template<ShBindingType Binding, typename T, bool Swizzled> 00489 inline 00490 ShAttrib<1, Binding, T, Swizzled>& 00491 ShAttrib<1, Binding, T, Swizzled>::operator%=(T right) 00492 { 00493 ParentType::operator%=(right); 00494 return *this; 00495 } 00496 00497 template<ShBindingType Binding, typename T, bool Swizzled> 00498 inline 00499 ShAttrib<1, Binding, T, true> 00500 ShAttrib<1, Binding, T, Swizzled>::operator()(int s0) const 00501 { 00502 return ShAttrib<1, Binding, T, true>(m_node, m_swizzle * ShSwizzle(1, s0), m_neg); 00503 } 00504 00505 template<ShBindingType Binding, typename T, bool Swizzled> 00506 inline 00507 ShAttrib<2, Binding, T, true> 00508 ShAttrib<1, Binding, T, Swizzled>::operator()(int s0, int s1) const 00509 { 00510 return ShAttrib<2, Binding, T, true>(m_node, m_swizzle * ShSwizzle(1, s0, s1), m_neg); 00511 } 00512 00513 template<ShBindingType Binding, typename T, bool Swizzled> 00514 inline 00515 ShAttrib<3, Binding, T, true> 00516 ShAttrib<1, Binding, T, Swizzled>::operator()(int s0, int s1, int s2) const 00517 { 00518 return ShAttrib<3, Binding, T, true>(m_node, m_swizzle * ShSwizzle(1, s0, s1, s2), m_neg); 00519 } 00520 00521 template<ShBindingType Binding, typename T, bool Swizzled> 00522 inline 00523 ShAttrib<4, Binding, T, true> 00524 ShAttrib<1, Binding, T, Swizzled>::operator()(int s0, int s1, int s2, int s3) const 00525 { 00526 return ShAttrib<4, Binding, T, true>(m_node, m_swizzle * ShSwizzle(1, s0, s1, s2, s3), m_neg); 00527 } 00528 00529 template<ShBindingType Binding, typename T, bool Swizzled> 00530 template<int N2> 00531 ShAttrib<N2, Binding, T, true> 00532 ShAttrib<1, Binding, T, Swizzled>::swiz(int indices[]) const 00533 { 00534 return ShAttrib<N2, Binding, T, true>(m_node, m_swizzle * ShSwizzle(1, N2, indices), m_neg); 00535 } 00536 00537 template<ShBindingType Binding, typename T, bool Swizzled> 00538 inline 00539 ShAttrib<1, Binding, T, true> 00540 ShAttrib<1, Binding, T, Swizzled>::operator[](int s0) const 00541 { 00542 return ShAttrib<1, Binding, T, true>(m_node, m_swizzle * ShSwizzle(1, s0), m_neg); 00543 } 00544 00545 template<ShBindingType Binding, typename T, bool Swizzled> 00546 ShAttrib<1, Binding, T, Swizzled> 00547 ShAttrib<1, Binding, T, Swizzled>::operator-() const 00548 { 00549 return ShAttrib<1, Binding, T, Swizzled>(m_node, m_swizzle, !m_neg); 00550 } 00551 00552 template<ShBindingType Binding, typename T, bool Swizzled> 00553 inline 00554 ShAttrib<2, Binding, T, Swizzled>::ShAttrib() 00555 : ShGeneric<2, T>(new ShVariableNode(Binding, 2)) 00556 { 00557 } 00558 00559 template<ShBindingType Binding, typename T, bool Swizzled> 00560 inline 00561 ShAttrib<2, Binding, T, Swizzled>::ShAttrib(const ShGeneric<2, T>& other) 00562 : ShGeneric<2, T>(new ShVariableNode(Binding, 2)) 00563 { 00564 shASN(*this, other); 00565 } 00566 00567 template<ShBindingType Binding, typename T, bool Swizzled> 00568 inline 00569 ShAttrib<2, Binding, T, Swizzled>::ShAttrib(const ShAttrib<2, Binding, T, Swizzled>& other) 00570 : ShGeneric<2, T>(new ShVariableNode(Binding, 2)) 00571 { 00572 shASN(*this, other); 00573 } 00574 00575 template<ShBindingType Binding, typename T, bool Swizzled> 00576 inline 00577 ShAttrib<2, Binding, T, Swizzled>::ShAttrib(const ShVariableNodePtr& node, 00578 const ShSwizzle& swizzle, bool neg) 00579 : ShGeneric<2, T>(node, swizzle, neg) 00580 { 00581 } 00582 00583 template<ShBindingType Binding, typename T, bool Swizzled> 00584 inline 00585 ShAttrib<2, Binding, T, Swizzled>::ShAttrib(T data[2]) 00586 : ShGeneric<2, T>(new ShVariableNode(Binding, 2)) 00587 { 00588 if (Binding == SH_CONST) { 00589 for (int i = 0; i < 2; i++) m_node->setValue(i, data[i]); 00590 } else { 00591 (*this) = ShAttrib<2, SH_CONST, T>(data); 00592 } 00593 } 00594 00595 template<ShBindingType Binding, typename T, bool Swizzled> 00596 inline 00597 ShAttrib<2, Binding, T, Swizzled>::ShAttrib(T s0, T s1) 00598 : ShGeneric<2, T>(new ShVariableNode(Binding, 2)) 00599 { 00600 if (Binding == SH_CONST) { 00601 m_node->setValue(0, s0); 00602 m_node->setValue(1, s1); 00603 } else { 00604 (*this)[0] = ShAttrib<1, SH_CONST, T>(s0); 00605 (*this)[1] = ShAttrib<1, SH_CONST, T>(s1); 00606 } 00607 } 00608 00609 template<ShBindingType Binding, typename T, bool Swizzled> 00610 inline 00611 ShAttrib<2, Binding, T, Swizzled>::ShAttrib(const ShGeneric<1, T>& s0, const ShGeneric<1, T>& s1) 00612 : ShGeneric<2, T>(new ShVariableNode(Binding, 2)) 00613 { 00614 if (Binding == SH_CONST) { 00615 SH_DEBUG_ASSERT(s0.hasValues()); 00616 m_node->setValue(0, s0.getValue(0)); 00617 SH_DEBUG_ASSERT(s1.hasValues()); 00618 m_node->setValue(1, s1.getValue(0)); 00619 } else { 00620 (*this)[0] = s0; 00621 (*this)[1] = s1; 00622 } 00623 } 00624 00625 template<ShBindingType Binding, typename T, bool Swizzled> 00626 inline 00627 ShAttrib<2, Binding, T, Swizzled>::~ShAttrib() 00628 { 00629 } 00630 00631 template<ShBindingType Binding, typename T, bool Swizzled> 00632 inline 00633 ShAttrib<2, Binding, T, Swizzled>& 00634 ShAttrib<2, Binding, T, Swizzled>::operator=(const ShGeneric<2, T>& other) 00635 { 00636 ParentType::operator=(other); 00637 return *this; 00638 } 00639 00640 template<ShBindingType Binding, typename T, bool Swizzled> 00641 inline 00642 ShAttrib<2, Binding, T, Swizzled>& 00643 ShAttrib<2, Binding, T, Swizzled>::operator=(const ShAttrib<2, Binding, T, Swizzled>& other) 00644 { 00645 ParentType::operator=(other); 00646 return *this; 00647 } 00648 00649 template<ShBindingType Binding, typename T, bool Swizzled> 00650 inline 00651 ShAttrib<2, Binding, T, Swizzled>& 00652 ShAttrib<2, Binding, T, Swizzled>::operator=(const ShProgram& prg) 00653 { 00654 ParentType::operator=(prg); 00655 return *this; 00656 } 00657 00658 template<ShBindingType Binding, typename T, bool Swizzled> 00659 inline 00660 ShAttrib<2, Binding, T, Swizzled>& 00661 ShAttrib<2, Binding, T, Swizzled>::operator+=(const ShGeneric<2, T>& right) 00662 { 00663 ParentType::operator+=(right); 00664 return *this; 00665 } 00666 00667 template<ShBindingType Binding, typename T, bool Swizzled> 00668 inline 00669 ShAttrib<2, Binding, T, Swizzled>& 00670 ShAttrib<2, Binding, T, Swizzled>::operator-=(const ShGeneric<2, T>& right) 00671 { 00672 ParentType::operator-=(right); 00673 return *this; 00674 } 00675 00676 template<ShBindingType Binding, typename T, bool Swizzled> 00677 inline 00678 ShAttrib<2, Binding, T, Swizzled>& 00679 ShAttrib<2, Binding, T, Swizzled>::operator*=(const ShGeneric<2, T>& right) 00680 { 00681 ParentType::operator*=(right); 00682 return *this; 00683 } 00684 00685 template<ShBindingType Binding, typename T, bool Swizzled> 00686 inline 00687 ShAttrib<2, Binding, T, Swizzled>& 00688 ShAttrib<2, Binding, T, Swizzled>::operator/=(const ShGeneric<2, T>& right) 00689 { 00690 ParentType::operator/=(right); 00691 return *this; 00692 } 00693 00694 template<ShBindingType Binding, typename T, bool Swizzled> 00695 inline 00696 ShAttrib<2, Binding, T, Swizzled>& 00697 ShAttrib<2, Binding, T, Swizzled>::operator%=(const ShGeneric<2, T>& right) 00698 { 00699 ParentType::operator%=(right); 00700 return *this; 00701 } 00702 00703 template<ShBindingType Binding, typename T, bool Swizzled> 00704 inline 00705 ShAttrib<2, Binding, T, Swizzled>& 00706 ShAttrib<2, Binding, T, Swizzled>::operator+=(T right) 00707 { 00708 ParentType::operator+=(right); 00709 return *this; 00710 } 00711 00712 template<ShBindingType Binding, typename T, bool Swizzled> 00713 inline 00714 ShAttrib<2, Binding, T, Swizzled>& 00715 ShAttrib<2, Binding, T, Swizzled>::operator-=(T right) 00716 { 00717 ParentType::operator-=(right); 00718 return *this; 00719 } 00720 00721 template<ShBindingType Binding, typename T, bool Swizzled> 00722 inline 00723 ShAttrib<2, Binding, T, Swizzled>& 00724 ShAttrib<2, Binding, T, Swizzled>::operator*=(T right) 00725 { 00726 ParentType::operator*=(right); 00727 return *this; 00728 } 00729 00730 template<ShBindingType Binding, typename T, bool Swizzled> 00731 inline 00732 ShAttrib<2, Binding, T, Swizzled>& 00733 ShAttrib<2, Binding, T, Swizzled>::operator/=(T right) 00734 { 00735 ParentType::operator/=(right); 00736 return *this; 00737 } 00738 00739 template<ShBindingType Binding, typename T, bool Swizzled> 00740 inline 00741 ShAttrib<2, Binding, T, Swizzled>& 00742 ShAttrib<2, Binding, T, Swizzled>::operator%=(T right) 00743 { 00744 ParentType::operator%=(right); 00745 return *this; 00746 } 00747 00748 template<ShBindingType Binding, typename T, bool Swizzled> 00749 inline 00750 ShAttrib<2, Binding, T, Swizzled>& 00751 ShAttrib<2, Binding, T, Swizzled>::operator+=(const ShGeneric<1, T>& right) 00752 { 00753 ParentType::operator+=(right); 00754 return *this; 00755 } 00756 00757 template<ShBindingType Binding, typename T, bool Swizzled> 00758 inline 00759 ShAttrib<2, Binding, T, Swizzled>& 00760 ShAttrib<2, Binding, T, Swizzled>::operator-=(const ShGeneric<1, T>& right) 00761 { 00762 ParentType::operator-=(right); 00763 return *this; 00764 } 00765 00766 template<ShBindingType Binding, typename T, bool Swizzled> 00767 inline 00768 ShAttrib<2, Binding, T, Swizzled>& 00769 ShAttrib<2, Binding, T, Swizzled>::operator*=(const ShGeneric<1, T>& right) 00770 { 00771 ParentType::operator*=(right); 00772 return *this; 00773 } 00774 00775 template<ShBindingType Binding, typename T, bool Swizzled> 00776 inline 00777 ShAttrib<2, Binding, T, Swizzled>& 00778 ShAttrib<2, Binding, T, Swizzled>::operator/=(const ShGeneric<1, T>& right) 00779 { 00780 ParentType::operator/=(right); 00781 return *this; 00782 } 00783 00784 template<ShBindingType Binding, typename T, bool Swizzled> 00785 inline 00786 ShAttrib<2, Binding, T, Swizzled>& 00787 ShAttrib<2, Binding, T, Swizzled>::operator%=(const ShGeneric<1, T>& right) 00788 { 00789 ParentType::operator%=(right); 00790 return *this; 00791 } 00792 00793 template<ShBindingType Binding, typename T, bool Swizzled> 00794 inline 00795 ShAttrib<1, Binding, T, true> 00796 ShAttrib<2, Binding, T, Swizzled>::operator()(int s0) const 00797 { 00798 return ShAttrib<1, Binding, T, true>(m_node, m_swizzle * ShSwizzle(2, s0), m_neg); 00799 } 00800 00801 template<ShBindingType Binding, typename T, bool Swizzled> 00802 inline 00803 ShAttrib<2, Binding, T, true> 00804 ShAttrib<2, Binding, T, Swizzled>::operator()(int s0, int s1) const 00805 { 00806 return ShAttrib<2, Binding, T, true>(m_node, m_swizzle * ShSwizzle(2, s0, s1), m_neg); 00807 } 00808 00809 template<ShBindingType Binding, typename T, bool Swizzled> 00810 inline 00811 ShAttrib<3, Binding, T, true> 00812 ShAttrib<2, Binding, T, Swizzled>::operator()(int s0, int s1, int s2) const 00813 { 00814 return ShAttrib<3, Binding, T, true>(m_node, m_swizzle * ShSwizzle(2, s0, s1, s2), m_neg); 00815 } 00816 00817 template<ShBindingType Binding, typename T, bool Swizzled> 00818 inline 00819 ShAttrib<4, Binding, T, true> 00820 ShAttrib<2, Binding, T, Swizzled>::operator()(int s0, int s1, int s2, int s3) const 00821 { 00822 return ShAttrib<4, Binding, T, true>(m_node, m_swizzle * ShSwizzle(2, s0, s1, s2, s3), m_neg); 00823 } 00824 00825 template<ShBindingType Binding, typename T, bool Swizzled> 00826 template<int N2> 00827 ShAttrib<N2, Binding, T, true> 00828 ShAttrib<2, Binding, T, Swizzled>::swiz(int indices[]) const 00829 { 00830 return ShAttrib<N2, Binding, T, true>(m_node, m_swizzle * ShSwizzle(2, N2, indices), m_neg); 00831 } 00832 00833 template<ShBindingType Binding, typename T, bool Swizzled> 00834 inline 00835 ShAttrib<1, Binding, T, true> 00836 ShAttrib<2, Binding, T, Swizzled>::operator[](int s0) const 00837 { 00838 return ShAttrib<1, Binding, T, true>(m_node, m_swizzle * ShSwizzle(2, s0), m_neg); 00839 } 00840 00841 template<ShBindingType Binding, typename T, bool Swizzled> 00842 ShAttrib<2, Binding, T, Swizzled> 00843 ShAttrib<2, Binding, T, Swizzled>::operator-() const 00844 { 00845 return ShAttrib<2, Binding, T, Swizzled>(m_node, m_swizzle, !m_neg); 00846 } 00847 00848 template<ShBindingType Binding, typename T, bool Swizzled> 00849 inline 00850 ShAttrib<3, Binding, T, Swizzled>::ShAttrib() 00851 : ShGeneric<3, T>(new ShVariableNode(Binding, 3)) 00852 { 00853 } 00854 00855 template<ShBindingType Binding, typename T, bool Swizzled> 00856 inline 00857 ShAttrib<3, Binding, T, Swizzled>::ShAttrib(const ShGeneric<3, T>& other) 00858 : ShGeneric<3, T>(new ShVariableNode(Binding, 3)) 00859 { 00860 shASN(*this, other); 00861 } 00862 00863 template<ShBindingType Binding, typename T, bool Swizzled> 00864 inline 00865 ShAttrib<3, Binding, T, Swizzled>::ShAttrib(const ShAttrib<3, Binding, T, Swizzled>& other) 00866 : ShGeneric<3, T>(new ShVariableNode(Binding, 3)) 00867 { 00868 shASN(*this, other); 00869 } 00870 00871 template<ShBindingType Binding, typename T, bool Swizzled> 00872 inline 00873 ShAttrib<3, Binding, T, Swizzled>::ShAttrib(const ShVariableNodePtr& node, 00874 const ShSwizzle& swizzle, bool neg) 00875 : ShGeneric<3, T>(node, swizzle, neg) 00876 { 00877 } 00878 00879 template<ShBindingType Binding, typename T, bool Swizzled> 00880 inline 00881 ShAttrib<3, Binding, T, Swizzled>::ShAttrib(T data[3]) 00882 : ShGeneric<3, T>(new ShVariableNode(Binding, 3)) 00883 { 00884 if (Binding == SH_CONST) { 00885 for (int i = 0; i < 3; i++) m_node->setValue(i, data[i]); 00886 } else { 00887 (*this) = ShAttrib<3, SH_CONST, T>(data); 00888 } 00889 } 00890 00891 template<ShBindingType Binding, typename T, bool Swizzled> 00892 inline 00893 ShAttrib<3, Binding, T, Swizzled>::ShAttrib(T s0, T s1, T s2) 00894 : ShGeneric<3, T>(new ShVariableNode(Binding, 3)) 00895 { 00896 if (Binding == SH_CONST) { 00897 m_node->setValue(0, s0); 00898 m_node->setValue(1, s1); 00899 m_node->setValue(2, s2); 00900 } else { 00901 (*this)[0] = ShAttrib<1, SH_CONST, T>(s0); 00902 (*this)[1] = ShAttrib<1, SH_CONST, T>(s1); 00903 (*this)[2] = ShAttrib<1, SH_CONST, T>(s2); 00904 } 00905 } 00906 00907 template<ShBindingType Binding, typename T, bool Swizzled> 00908 inline 00909 ShAttrib<3, Binding, T, Swizzled>::ShAttrib(const ShGeneric<1, T>& s0, const ShGeneric<1, T>& s1, const ShGeneric<1, T>& s2) 00910 : ShGeneric<3, T>(new ShVariableNode(Binding, 3)) 00911 { 00912 if (Binding == SH_CONST) { 00913 SH_DEBUG_ASSERT(s0.hasValues()); 00914 m_node->setValue(0, s0.getValue(0)); 00915 SH_DEBUG_ASSERT(s1.hasValues()); 00916 m_node->setValue(1, s1.getValue(0)); 00917 SH_DEBUG_ASSERT(s2.hasValues()); 00918 m_node->setValue(2, s2.getValue(0)); 00919 } else { 00920 (*this)[0] = s0; 00921 (*this)[1] = s1; 00922 (*this)[2] = s2; 00923 } 00924 } 00925 00926 template<ShBindingType Binding, typename T, bool Swizzled> 00927 inline 00928 ShAttrib<3, Binding, T, Swizzled>::~ShAttrib() 00929 { 00930 } 00931 00932 template<ShBindingType Binding, typename T, bool Swizzled> 00933 inline 00934 ShAttrib<3, Binding, T, Swizzled>& 00935 ShAttrib<3, Binding, T, Swizzled>::operator=(const ShGeneric<3, T>& other) 00936 { 00937 ParentType::operator=(other); 00938 return *this; 00939 } 00940 00941 template<ShBindingType Binding, typename T, bool Swizzled> 00942 inline 00943 ShAttrib<3, Binding, T, Swizzled>& 00944 ShAttrib<3, Binding, T, Swizzled>::operator=(const ShAttrib<3, Binding, T, Swizzled>& other) 00945 { 00946 ParentType::operator=(other); 00947 return *this; 00948 } 00949 00950 template<ShBindingType Binding, typename T, bool Swizzled> 00951 inline 00952 ShAttrib<3, Binding, T, Swizzled>& 00953 ShAttrib<3, Binding, T, Swizzled>::operator=(const ShProgram& prg) 00954 { 00955 ParentType::operator=(prg); 00956 return *this; 00957 } 00958 00959 template<ShBindingType Binding, typename T, bool Swizzled> 00960 inline 00961 ShAttrib<3, Binding, T, Swizzled>& 00962 ShAttrib<3, Binding, T, Swizzled>::operator+=(const ShGeneric<3, T>& right) 00963 { 00964 ParentType::operator+=(right); 00965 return *this; 00966 } 00967 00968 template<ShBindingType Binding, typename T, bool Swizzled> 00969 inline 00970 ShAttrib<3, Binding, T, Swizzled>& 00971 ShAttrib<3, Binding, T, Swizzled>::operator-=(const ShGeneric<3, T>& right) 00972 { 00973 ParentType::operator-=(right); 00974 return *this; 00975 } 00976 00977 template<ShBindingType Binding, typename T, bool Swizzled> 00978 inline 00979 ShAttrib<3, Binding, T, Swizzled>& 00980 ShAttrib<3, Binding, T, Swizzled>::operator*=(const ShGeneric<3, T>& right) 00981 { 00982 ParentType::operator*=(right); 00983 return *this; 00984 } 00985 00986 template<ShBindingType Binding, typename T, bool Swizzled> 00987 inline 00988 ShAttrib<3, Binding, T, Swizzled>& 00989 ShAttrib<3, Binding, T, Swizzled>::operator/=(const ShGeneric<3, T>& right) 00990 { 00991 ParentType::operator/=(right); 00992 return *this; 00993 } 00994 00995 template<ShBindingType Binding, typename T, bool Swizzled> 00996 inline 00997 ShAttrib<3, Binding, T, Swizzled>& 00998 ShAttrib<3, Binding, T, Swizzled>::operator%=(const ShGeneric<3, T>& right) 00999 { 01000 ParentType::operator%=(right); 01001 return *this; 01002 } 01003 01004 template<ShBindingType Binding, typename T, bool Swizzled> 01005 inline 01006 ShAttrib<3, Binding, T, Swizzled>& 01007 ShAttrib<3, Binding, T, Swizzled>::operator+=(T right) 01008 { 01009 ParentType::operator+=(right); 01010 return *this; 01011 } 01012 01013 template<ShBindingType Binding, typename T, bool Swizzled> 01014 inline 01015 ShAttrib<3, Binding, T, Swizzled>& 01016 ShAttrib<3, Binding, T, Swizzled>::operator-=(T right) 01017 { 01018 ParentType::operator-=(right); 01019 return *this; 01020 } 01021 01022 template<ShBindingType Binding, typename T, bool Swizzled> 01023 inline 01024 ShAttrib<3, Binding, T, Swizzled>& 01025 ShAttrib<3, Binding, T, Swizzled>::operator*=(T right) 01026 { 01027 ParentType::operator*=(right); 01028 return *this; 01029 } 01030 01031 template<ShBindingType Binding, typename T, bool Swizzled> 01032 inline 01033 ShAttrib<3, Binding, T, Swizzled>& 01034 ShAttrib<3, Binding, T, Swizzled>::operator/=(T right) 01035 { 01036 ParentType::operator/=(right); 01037 return *this; 01038 } 01039 01040 template<ShBindingType Binding, typename T, bool Swizzled> 01041 inline 01042 ShAttrib<3, Binding, T, Swizzled>& 01043 ShAttrib<3, Binding, T, Swizzled>::operator%=(T right) 01044 { 01045 ParentType::operator%=(right); 01046 return *this; 01047 } 01048 01049 template<ShBindingType Binding, typename T, bool Swizzled> 01050 inline 01051 ShAttrib<3, Binding, T, Swizzled>& 01052 ShAttrib<3, Binding, T, Swizzled>::operator+=(const ShGeneric<1, T>& right) 01053 { 01054 ParentType::operator+=(right); 01055 return *this; 01056 } 01057 01058 template<ShBindingType Binding, typename T, bool Swizzled> 01059 inline 01060 ShAttrib<3, Binding, T, Swizzled>& 01061 ShAttrib<3, Binding, T, Swizzled>::operator-=(const ShGeneric<1, T>& right) 01062 { 01063 ParentType::operator-=(right); 01064 return *this; 01065 } 01066 01067 template<ShBindingType Binding, typename T, bool Swizzled> 01068 inline 01069 ShAttrib<3, Binding, T, Swizzled>& 01070 ShAttrib<3, Binding, T, Swizzled>::operator*=(const ShGeneric<1, T>& right) 01071 { 01072 ParentType::operator*=(right); 01073 return *this; 01074 } 01075 01076 template<ShBindingType Binding, typename T, bool Swizzled> 01077 inline 01078 ShAttrib<3, Binding, T, Swizzled>& 01079 ShAttrib<3, Binding, T, Swizzled>::operator/=(const ShGeneric<1, T>& right) 01080 { 01081 ParentType::operator/=(right); 01082 return *this; 01083 } 01084 01085 template<ShBindingType Binding, typename T, bool Swizzled> 01086 inline 01087 ShAttrib<3, Binding, T, Swizzled>& 01088 ShAttrib<3, Binding, T, Swizzled>::operator%=(const ShGeneric<1, T>& right) 01089 { 01090 ParentType::operator%=(right); 01091 return *this; 01092 } 01093 01094 template<ShBindingType Binding, typename T, bool Swizzled> 01095 inline 01096 ShAttrib<1, Binding, T, true> 01097 ShAttrib<3, Binding, T, Swizzled>::operator()(int s0) const 01098 { 01099 return ShAttrib<1, Binding, T, true>(m_node, m_swizzle * ShSwizzle(3, s0), m_neg); 01100 } 01101 01102 template<ShBindingType Binding, typename T, bool Swizzled> 01103 inline 01104 ShAttrib<2, Binding, T, true> 01105 ShAttrib<3, Binding, T, Swizzled>::operator()(int s0, int s1) const 01106 { 01107 return ShAttrib<2, Binding, T, true>(m_node, m_swizzle * ShSwizzle(3, s0, s1), m_neg); 01108 } 01109 01110 template<ShBindingType Binding, typename T, bool Swizzled> 01111 inline 01112 ShAttrib<3, Binding, T, true> 01113 ShAttrib<3, Binding, T, Swizzled>::operator()(int s0, int s1, int s2) const 01114 { 01115 return ShAttrib<3, Binding, T, true>(m_node, m_swizzle * ShSwizzle(3, s0, s1, s2), m_neg); 01116 } 01117 01118 template<ShBindingType Binding, typename T, bool Swizzled> 01119 inline 01120 ShAttrib<4, Binding, T, true> 01121 ShAttrib<3, Binding, T, Swizzled>::operator()(int s0, int s1, int s2, int s3) const 01122 { 01123 return ShAttrib<4, Binding, T, true>(m_node, m_swizzle * ShSwizzle(3, s0, s1, s2, s3), m_neg); 01124 } 01125 01126 template<ShBindingType Binding, typename T, bool Swizzled> 01127 template<int N2> 01128 ShAttrib<N2, Binding, T, true> 01129 ShAttrib<3, Binding, T, Swizzled>::swiz(int indices[]) const 01130 { 01131 return ShAttrib<N2, Binding, T, true>(m_node, m_swizzle * ShSwizzle(3, N2, indices), m_neg); 01132 } 01133 01134 template<ShBindingType Binding, typename T, bool Swizzled> 01135 inline 01136 ShAttrib<1, Binding, T, true> 01137 ShAttrib<3, Binding, T, Swizzled>::operator[](int s0) const 01138 { 01139 return ShAttrib<1, Binding, T, true>(m_node, m_swizzle * ShSwizzle(3, s0), m_neg); 01140 } 01141 01142 template<ShBindingType Binding, typename T, bool Swizzled> 01143 ShAttrib<3, Binding, T, Swizzled> 01144 ShAttrib<3, Binding, T, Swizzled>::operator-() const 01145 { 01146 return ShAttrib<3, Binding, T, Swizzled>(m_node, m_swizzle, !m_neg); 01147 } 01148 01149 template<ShBindingType Binding, typename T, bool Swizzled> 01150 inline 01151 ShAttrib<4, Binding, T, Swizzled>::ShAttrib() 01152 : ShGeneric<4, T>(new ShVariableNode(Binding, 4)) 01153 { 01154 } 01155 01156 template<ShBindingType Binding, typename T, bool Swizzled> 01157 inline 01158 ShAttrib<4, Binding, T, Swizzled>::ShAttrib(const ShGeneric<4, T>& other) 01159 : ShGeneric<4, T>(new ShVariableNode(Binding, 4)) 01160 { 01161 shASN(*this, other); 01162 } 01163 01164 template<ShBindingType Binding, typename T, bool Swizzled> 01165 inline 01166 ShAttrib<4, Binding, T, Swizzled>::ShAttrib(const ShAttrib<4, Binding, T, Swizzled>& other) 01167 : ShGeneric<4, T>(new ShVariableNode(Binding, 4)) 01168 { 01169 shASN(*this, other); 01170 } 01171 01172 template<ShBindingType Binding, typename T, bool Swizzled> 01173 inline 01174 ShAttrib<4, Binding, T, Swizzled>::ShAttrib(const ShVariableNodePtr& node, 01175 const ShSwizzle& swizzle, bool neg) 01176 : ShGeneric<4, T>(node, swizzle, neg) 01177 { 01178 } 01179 01180 template<ShBindingType Binding, typename T, bool Swizzled> 01181 inline 01182 ShAttrib<4, Binding, T, Swizzled>::ShAttrib(T data[4]) 01183 : ShGeneric<4, T>(new ShVariableNode(Binding, 4)) 01184 { 01185 if (Binding == SH_CONST) { 01186 for (int i = 0; i < 4; i++) m_node->setValue(i, data[i]); 01187 } else { 01188 (*this) = ShAttrib<4, SH_CONST, T>(data); 01189 } 01190 } 01191 01192 template<ShBindingType Binding, typename T, bool Swizzled> 01193 inline 01194 ShAttrib<4, Binding, T, Swizzled>::ShAttrib(T s0, T s1, T s2, T s3) 01195 : ShGeneric<4, T>(new ShVariableNode(Binding, 4)) 01196 { 01197 if (Binding == SH_CONST) { 01198 m_node->setValue(0, s0); 01199 m_node->setValue(1, s1); 01200 m_node->setValue(2, s2); 01201 m_node->setValue(3, s3); 01202 } else { 01203 (*this)[0] = ShAttrib<1, SH_CONST, T>(s0); 01204 (*this)[1] = ShAttrib<1, SH_CONST, T>(s1); 01205 (*this)[2] = ShAttrib<1, SH_CONST, T>(s2); 01206 (*this)[3] = ShAttrib<1, SH_CONST, T>(s3); 01207 } 01208 } 01209 01210 template<ShBindingType Binding, typename T, bool Swizzled> 01211 inline 01212 ShAttrib<4, Binding, T, Swizzled>::ShAttrib(const ShGeneric<1, T>& s0, const ShGeneric<1, T>& s1, const ShGeneric<1, T>& s2, const ShGeneric<1, T>& s3) 01213 : ShGeneric<4, T>(new ShVariableNode(Binding, 4)) 01214 { 01215 if (Binding == SH_CONST) { 01216 SH_DEBUG_ASSERT(s0.hasValues()); 01217 m_node->setValue(0, s0.getValue(0)); 01218 SH_DEBUG_ASSERT(s1.hasValues()); 01219 m_node->setValue(1, s1.getValue(0)); 01220 SH_DEBUG_ASSERT(s2.hasValues()); 01221 m_node->setValue(2, s2.getValue(0)); 01222 SH_DEBUG_ASSERT(s3.hasValues()); 01223 m_node->setValue(3, s3.getValue(0)); 01224 } else { 01225 (*this)[0] = s0; 01226 (*this)[1] = s1; 01227 (*this)[2] = s2; 01228 (*this)[3] = s3; 01229 } 01230 } 01231 01232 template<ShBindingType Binding, typename T, bool Swizzled> 01233 inline 01234 ShAttrib<4, Binding, T, Swizzled>::~ShAttrib() 01235 { 01236 } 01237 01238 template<ShBindingType Binding, typename T, bool Swizzled> 01239 inline 01240 ShAttrib<4, Binding, T, Swizzled>& 01241 ShAttrib<4, Binding, T, Swizzled>::operator=(const ShGeneric<4, T>& other) 01242 { 01243 ParentType::operator=(other); 01244 return *this; 01245 } 01246 01247 template<ShBindingType Binding, typename T, bool Swizzled> 01248 inline 01249 ShAttrib<4, Binding, T, Swizzled>& 01250 ShAttrib<4, Binding, T, Swizzled>::operator=(const ShAttrib<4, Binding, T, Swizzled>& other) 01251 { 01252 ParentType::operator=(other); 01253 return *this; 01254 } 01255 01256 template<ShBindingType Binding, typename T, bool Swizzled> 01257 inline 01258 ShAttrib<4, Binding, T, Swizzled>& 01259 ShAttrib<4, Binding, T, Swizzled>::operator=(const ShProgram& prg) 01260 { 01261 ParentType::operator=(prg); 01262 return *this; 01263 } 01264 01265 template<ShBindingType Binding, typename T, bool Swizzled> 01266 inline 01267 ShAttrib<4, Binding, T, Swizzled>& 01268 ShAttrib<4, Binding, T, Swizzled>::operator+=(const ShGeneric<4, T>& right) 01269 { 01270 ParentType::operator+=(right); 01271 return *this; 01272 } 01273 01274 template<ShBindingType Binding, typename T, bool Swizzled> 01275 inline 01276 ShAttrib<4, Binding, T, Swizzled>& 01277 ShAttrib<4, Binding, T, Swizzled>::operator-=(const ShGeneric<4, T>& right) 01278 { 01279 ParentType::operator-=(right); 01280 return *this; 01281 } 01282 01283 template<ShBindingType Binding, typename T, bool Swizzled> 01284 inline 01285 ShAttrib<4, Binding, T, Swizzled>& 01286 ShAttrib<4, Binding, T, Swizzled>::operator*=(const ShGeneric<4, T>& right) 01287 { 01288 ParentType::operator*=(right); 01289 return *this; 01290 } 01291 01292 template<ShBindingType Binding, typename T, bool Swizzled> 01293 inline 01294 ShAttrib<4, Binding, T, Swizzled>& 01295 ShAttrib<4, Binding, T, Swizzled>::operator/=(const ShGeneric<4, T>& right) 01296 { 01297 ParentType::operator/=(right); 01298 return *this; 01299 } 01300 01301 template<ShBindingType Binding, typename T, bool Swizzled> 01302 inline 01303 ShAttrib<4, Binding, T, Swizzled>& 01304 ShAttrib<4, Binding, T, Swizzled>::operator%=(const ShGeneric<4, T>& right) 01305 { 01306 ParentType::operator%=(right); 01307 return *this; 01308 } 01309 01310 template<ShBindingType Binding, typename T, bool Swizzled> 01311 inline 01312 ShAttrib<4, Binding, T, Swizzled>& 01313 ShAttrib<4, Binding, T, Swizzled>::operator+=(T right) 01314 { 01315 ParentType::operator+=(right); 01316 return *this; 01317 } 01318 01319 template<ShBindingType Binding, typename T, bool Swizzled> 01320 inline 01321 ShAttrib<4, Binding, T, Swizzled>& 01322 ShAttrib<4, Binding, T, Swizzled>::operator-=(T right) 01323 { 01324 ParentType::operator-=(right); 01325 return *this; 01326 } 01327 01328 template<ShBindingType Binding, typename T, bool Swizzled> 01329 inline 01330 ShAttrib<4, Binding, T, Swizzled>& 01331 ShAttrib<4, Binding, T, Swizzled>::operator*=(T right) 01332 { 01333 ParentType::operator*=(right); 01334 return *this; 01335 } 01336 01337 template<ShBindingType Binding, typename T, bool Swizzled> 01338 inline 01339 ShAttrib<4, Binding, T, Swizzled>& 01340 ShAttrib<4, Binding, T, Swizzled>::operator/=(T right) 01341 { 01342 ParentType::operator/=(right); 01343 return *this; 01344 } 01345 01346 template<ShBindingType Binding, typename T, bool Swizzled> 01347 inline 01348 ShAttrib<4, Binding, T, Swizzled>& 01349 ShAttrib<4, Binding, T, Swizzled>::operator%=(T right) 01350 { 01351 ParentType::operator%=(right); 01352 return *this; 01353 } 01354 01355 template<ShBindingType Binding, typename T, bool Swizzled> 01356 inline 01357 ShAttrib<4, Binding, T, Swizzled>& 01358 ShAttrib<4, Binding, T, Swizzled>::operator+=(const ShGeneric<1, T>& right) 01359 { 01360 ParentType::operator+=(right); 01361 return *this; 01362 } 01363 01364 template<ShBindingType Binding, typename T, bool Swizzled> 01365 inline 01366 ShAttrib<4, Binding, T, Swizzled>& 01367 ShAttrib<4, Binding, T, Swizzled>::operator-=(const ShGeneric<1, T>& right) 01368 { 01369 ParentType::operator-=(right); 01370 return *this; 01371 } 01372 01373 template<ShBindingType Binding, typename T, bool Swizzled> 01374 inline 01375 ShAttrib<4, Binding, T, Swizzled>& 01376 ShAttrib<4, Binding, T, Swizzled>::operator*=(const ShGeneric<1, T>& right) 01377 { 01378 ParentType::operator*=(right); 01379 return *this; 01380 } 01381 01382 template<ShBindingType Binding, typename T, bool Swizzled> 01383 inline 01384 ShAttrib<4, Binding, T, Swizzled>& 01385 ShAttrib<4, Binding, T, Swizzled>::operator/=(const ShGeneric<1, T>& right) 01386 { 01387 ParentType::operator/=(right); 01388 return *this; 01389 } 01390 01391 template<ShBindingType Binding, typename T, bool Swizzled> 01392 inline 01393 ShAttrib<4, Binding, T, Swizzled>& 01394 ShAttrib<4, Binding, T, Swizzled>::operator%=(const ShGeneric<1, T>& right) 01395 { 01396 ParentType::operator%=(right); 01397 return *this; 01398 } 01399 01400 template<ShBindingType Binding, typename T, bool Swizzled> 01401 inline 01402 ShAttrib<1, Binding, T, true> 01403 ShAttrib<4, Binding, T, Swizzled>::operator()(int s0) const 01404 { 01405 return ShAttrib<1, Binding, T, true>(m_node, m_swizzle * ShSwizzle(4, s0), m_neg); 01406 } 01407 01408 template<ShBindingType Binding, typename T, bool Swizzled> 01409 inline 01410 ShAttrib<2, Binding, T, true> 01411 ShAttrib<4, Binding, T, Swizzled>::operator()(int s0, int s1) const 01412 { 01413 return ShAttrib<2, Binding, T, true>(m_node, m_swizzle * ShSwizzle(4, s0, s1), m_neg); 01414 } 01415 01416 template<ShBindingType Binding, typename T, bool Swizzled> 01417 inline 01418 ShAttrib<3, Binding, T, true> 01419 ShAttrib<4, Binding, T, Swizzled>::operator()(int s0, int s1, int s2) const 01420 { 01421 return ShAttrib<3, Binding, T, true>(m_node, m_swizzle * ShSwizzle(4, s0, s1, s2), m_neg); 01422 } 01423 01424 template<ShBindingType Binding, typename T, bool Swizzled> 01425 inline 01426 ShAttrib<4, Binding, T, true> 01427 ShAttrib<4, Binding, T, Swizzled>::operator()(int s0, int s1, int s2, int s3) const 01428 { 01429 return ShAttrib<4, Binding, T, true>(m_node, m_swizzle * ShSwizzle(4, s0, s1, s2, s3), m_neg); 01430 } 01431 01432 template<ShBindingType Binding, typename T, bool Swizzled> 01433 template<int N2> 01434 ShAttrib<N2, Binding, T, true> 01435 ShAttrib<4, Binding, T, Swizzled>::swiz(int indices[]) const 01436 { 01437 return ShAttrib<N2, Binding, T, true>(m_node, m_swizzle * ShSwizzle(4, N2, indices), m_neg); 01438 } 01439 01440 template<ShBindingType Binding, typename T, bool Swizzled> 01441 inline 01442 ShAttrib<1, Binding, T, true> 01443 ShAttrib<4, Binding, T, Swizzled>::operator[](int s0) const 01444 { 01445 return ShAttrib<1, Binding, T, true>(m_node, m_swizzle * ShSwizzle(4, s0), m_neg); 01446 } 01447 01448 template<ShBindingType Binding, typename T, bool Swizzled> 01449 ShAttrib<4, Binding, T, Swizzled> 01450 ShAttrib<4, Binding, T, Swizzled>::operator-() const 01451 { 01452 return ShAttrib<4, Binding, T, Swizzled>(m_node, m_swizzle, !m_neg); 01453 } 01454 01455 01456 } // namespace SH 01457 01458 #endif // SH_SHATTRIBIMPL_HPP

Generated on Mon Oct 18 14:17:38 2004 for Sh by doxygen 1.3.7