0001: // ----------------------------------------------------------------------------
0002: //
0003: // sumie.psh
0004: //
0005: //    Copyright (c) 2002 imagire takashi (imagire@gmail.com) All Rights Reserved.
0006: //
0007: // ----------------------------------------------------------------------------
0008: //
0009: // ; Result of Compile
0010: // ps.1.1
0011: //
0012: // def c0, 0.000000 0.000000 0.000000 0.150000
0013: //
0014: // ; Fetch texture color
0015: // tex t0      ; 0:0 0 0  1:0 1 0  2:0 0 0  3:0 0 0
0016: // tex t1      ;   0 1 0    0 0 0    0 0 0    0 0 0
0017: // tex t2      ;   0 0 0    0 0 0    1 0 0    0 0 1
0018: // tex t3
0019: //
0020: // add r1, t2, -t0
0021: // add r1, r1, t3
0022: // add r1, r1, -t0
0023: // add r1, r1, t1
0024: // add r1, r1, -t0
0025: // mul r1, c0.w, r1
0026: // add r0, r1, t0
0027: 
0028: // ----------------------------------------------------------------------------
0029: // Input
0030: // ----------------------------------------------------------------------------
0031: #pragma bind v2f_simple.position  = HPOS;
0032: #pragma bind v2f_simple.texcoord0 = TEX0;
0033: #pragma bind v2f_simple.texcoord1 = TEX1;
0034: #pragma bind v2f_simple.texcoord2 = TEX2;
0035: #pragma bind v2f_simple.texcoord3 = TEX3;
0036: 
0037: struct v2f_simple : vertex2fragment  {
0038:     float4 position;
0039:     float4 texcoord0;
0040:     float4 texcoord1;
0041:     float4 texcoord2;
0042:     float4 texcoord3;
0043: };
0044: 
0045: fragout main(v2f_simple I
0046:                 , uniform sampler2D tex0
0047:                 , uniform sampler2D tex1
0048:                 , uniform sampler2D tex2
0049:                 , uniform sampler2D tex3
0050: ) {
0051:     fragout O;
0052: 
0053:     // Fetch texture color
0054:     float4 t0 = tex2D(tex0);
0055:     float4 t1 = tex2D(tex1);
0056:     float4 t2 = tex2D(tex2);
0057:     float4 t3 = tex2D(tex3);
0058:     
0059:     O.col = 0.15f*(t2-t0+t3-t0+t1-t0)+t0;
0060:  
0061:     return O;
0062: } 
0063: 
0064: