1 /************************************************************************** 2 * 3 * Copyright 2011 Lauri Kasanen 4 * All Rights Reserved. 5 * 6 * Permission is hereby granted, free of charge, to any person obtaining a 7 * copy of this software and associated documentation files (the 8 * "Software"), to deal in the Software without restriction, including 9 * without limitation the rights to use, copy, modify, merge, publish, 10 * distribute, sub license, and/or sell copies of the Software, and to 11 * permit persons to whom the Software is furnished to do so, subject to 12 * the following conditions: 13 * 14 * The above copyright notice and this permission notice (including the 15 * next paragraph) shall be included in all copies or substantial portions 16 * of the Software. 17 * 18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 19 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 20 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. 21 * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR 22 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 23 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 24 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 25 * 26 **************************************************************************/ 27 28 #ifndef CELSHADE_H 29 #define CELSHADE_H 30 31 static const char celshade[] = "FRAG\n" 32 "PROPERTY FS_COLOR0_WRITES_ALL_CBUFS 1\n" 33 "DCL IN[0], GENERIC[0], PERSPECTIVE\n" 34 "DCL OUT[0], COLOR\n" 35 "DCL SAMP[0]\n" 36 "DCL TEMP[0..4]\n" 37 "IMM FLT32 { 0.2126, 0.7152, 0.0722, 4.0000}\n" 38 "IMM FLT32 { 0.5000, 2.0000, 1.0000, -0.1250}\n" 39 "IMM FLT32 { 0.2500, 0.1000, 0.1250, 3.0000}\n" 40 " 0: TEX TEMP[0], IN[0].xyyy, SAMP[0], 2D\n" 41 " 1: DP3 TEMP[1].x, TEMP[0].xyzz, IMM[0]\n" 42 " 2: MUL TEMP[3].x, TEMP[1].xxxx, IMM[0].wwww\n" 43 " 3: ROUND TEMP[2].x, TEMP[3].xxxx\n" 44 " 4: MUL TEMP[3].x, TEMP[2].xxxx, IMM[2].xxxx\n" 45 " 5: MOV TEMP[2].x, TEMP[3].xxxx\n" 46 " 6: ADD TEMP[4].x, TEMP[1].xxxx, -TEMP[3].xxxx\n" 47 " 7: SGT TEMP[1].w, TEMP[4].xxxx, IMM[2].yyyy\n" 48 " 8: IF TEMP[1].wwww :19\n" 49 " 9: ADD TEMP[4].y, TEMP[3].xxxx, IMM[2].yyyy\n" 50 " 10: ADD TEMP[1].z, TEMP[1].xxxx, -TEMP[4].yyyy\n" 51 " 11: ADD TEMP[1].y, TEMP[3].xxxx, IMM[2].zzzz\n" 52 " 12: ADD TEMP[2].x, TEMP[1].yyyy, -TEMP[4].yyyy\n" 53 " 13: RCP TEMP[4].y, TEMP[2].xxxx\n" 54 " 14: MUL TEMP[2].x, TEMP[1].zzzz, TEMP[4].yyyy\n" 55 " 15: MAD TEMP[1].y, -IMM[1].yyyy, TEMP[2].xxxx, IMM[2].wwww\n" 56 " 16: MUL TEMP[1].z, TEMP[2].xxxx, TEMP[1].yyyy\n" 57 " 17: MUL TEMP[1].y, TEMP[2].xxxx, TEMP[1].zzzz\n" 58 " 18: MAD TEMP[2].x, TEMP[1].yyyy, IMM[2].zzzz, TEMP[3].xxxx\n" 59 " 19: ENDIF\n" 60 " 20: SLT TEMP[3].x, TEMP[4].xxxx, -IMM[2].yyyy\n" 61 " 21: IF TEMP[3].xxxx :34\n" 62 " 22: ADD TEMP[3].x, TEMP[2].xxxx, -IMM[2].zzzz\n" 63 " 23: ADD TEMP[4].x, TEMP[1].xxxx, -TEMP[3].xxxx\n" 64 " 24: ADD TEMP[1].x, TEMP[2].xxxx, -IMM[2].yyyy\n" 65 " 25: ADD TEMP[4].y, TEMP[1].xxxx, -TEMP[3].xxxx\n" 66 " 26: RCP TEMP[3].x, TEMP[4].yyyy\n" 67 " 27: MUL TEMP[1].x, TEMP[4].xxxx, TEMP[3].xxxx\n" 68 " 28: MAD TEMP[4].x, -IMM[1].yyyy, TEMP[1].xxxx, IMM[2].wwww\n" 69 " 29: MUL TEMP[3].x, TEMP[1].xxxx, TEMP[4].xxxx\n" 70 " 30: MUL TEMP[4].x, TEMP[1].xxxx, TEMP[3].xxxx\n" 71 " 31: ADD TEMP[3].x, IMM[1].zzzz, -TEMP[4].xxxx\n" 72 " 32: MAD TEMP[1].x, TEMP[3].xxxx, -IMM[2].zzzz, TEMP[2].xxxx\n" 73 " 33: MOV TEMP[2].x, TEMP[1].xxxx\n" 74 " 34: ENDIF\n" 75 " 35: MAD TEMP[1].x, TEMP[2].xxxx, IMM[1].yyyy, IMM[2].yyyy\n" 76 " 36: MUL OUT[0], TEMP[0], TEMP[1].xxxx\n" 77 " 37: END\n"; 78 79 #endif 80