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

ShKernelSurfMap.cpp

00001 // Sh: A GPU metaprogramming language. 00002 // 00003 // Copyright (c) 2003 University of Waterloo Computer Graphics Laboratory 00004 // Project administrator: Michael D. McCool 00005 // Authors: Zheng Qin, Stefanus Du Toit, Kevin Moule, Tiberiu S. Popa, 00006 // Bryan Chan, Michael D. McCool 00007 // 00008 // This software is provided 'as-is', without any express or implied 00009 // warranty. In no event will the authors be held liable for any damages 00010 // arising from the use of this software. 00011 // 00012 // Permission is granted to anyone to use this software for any purpose, 00013 // including commercial applications, and to alter it and redistribute it 00014 // freely, subject to the following restrictions: 00015 // 00016 // 1. The origin of this software must not be misrepresented; you must 00017 // not claim that you wrote the original software. If you use this 00018 // software in a product, an acknowledgment in the product documentation 00019 // would be appreciated but is not required. 00020 // 00021 // 2. Altered source versions must be plainly marked as such, and must 00022 // not be misrepresented as being the original software. 00023 // 00024 // 3. This notice may not be removed or altered from any source 00025 // distribution. 00027 #include "ShKernelSurfMap.hpp" 00028 #include "ShFunc.hpp" 00029 #include "ShSyntax.hpp" 00030 #include "ShNormal.hpp" 00031 #include "ShLib.hpp" 00032 00033 namespace ShUtil { 00034 00035 ShProgram ShKernelSurfMap::bump() { 00036 ShProgram kernel = SH_BEGIN_PROGRAM() { 00037 ShInputAttrib2f SH_DECL(gradient); 00038 ShInOutNormal3f SH_DECL(normalt); 00039 00040 normalt(1,2) += gradient; 00041 } SH_END; 00042 return kernel; 00043 } 00044 00045 ShProgram ShKernelSurfMap::vcsBump() { 00046 ShProgram kernel = SH_BEGIN_PROGRAM() { 00047 ShInputAttrib2f SH_DECL(gradient); 00048 ShInOutNormal3f SH_DECL(normal); 00049 ShInputVector3f SH_DECL(tangent); 00050 ShInputVector3f SH_DECL(tangent2); 00051 00052 normal = mad(gradient(0), tangent, normal); 00053 normal = mad(gradient(1), tangent2, normal); 00054 } SH_END; 00055 return kernel; 00056 } 00057 00058 };

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