1 | ///////////////////////////////////////////////////////////////////////////////
|
---|
2 | //
|
---|
3 | // ## ######
|
---|
4 | // ###### ###
|
---|
5 | // ## ############### Shark 3D Engine (www.shark3d.com)
|
---|
6 | // ########## # # #
|
---|
7 | // ######## Copyright (c) 1996-2006 Spinor GmbH.
|
---|
8 | // ######### # # # All rights reserved.
|
---|
9 | // ## ##########
|
---|
10 | // ##
|
---|
11 | //
|
---|
12 | ///////////////////////////////////////////////////////////////////////////////
|
---|
13 |
|
---|
14 | struct PS_INPUT
|
---|
15 | {
|
---|
16 | float4 diffuse: COLOR0;
|
---|
17 | float2 texCoord0: TEXCOORD0;
|
---|
18 | float2 texCoord1: TEXCOORD1;
|
---|
19 | };
|
---|
20 |
|
---|
21 | ///////////////////////////////////////////////////////////////////////////////
|
---|
22 |
|
---|
23 | sampler tex0: register(s0);
|
---|
24 | sampler tex1: register(s1);
|
---|
25 |
|
---|
26 | float sourceTextureSize;
|
---|
27 | float epsilonX;
|
---|
28 | float epsilonY;
|
---|
29 | float sqrtNumSamples;
|
---|
30 |
|
---|
31 | ///////////////////////////////////////////////////////////////////////////////
|
---|
32 | // Pixelshader
|
---|
33 | // Profile: 2x0
|
---|
34 |
|
---|
35 | float4 main(PS_INPUT input): COLOR0
|
---|
36 | {
|
---|
37 | sourceTextureSize = 16.0;
|
---|
38 | sqrtNumSamples = 4.0;
|
---|
39 | epsilonX = -0.35;
|
---|
40 | epsilonY = -0.06;
|
---|
41 |
|
---|
42 | float4 ocolor = float4(0.0, 1.0, 0.0, 0.0);
|
---|
43 | float2 epsilon = float2(epsilonX, epsilonY);
|
---|
44 | float4 value = tex2D(tex0, input.texCoord1).xyzw;
|
---|
45 | float2 coords = float2(0.0, 1.0) - abs(input.texCoord0 - ( value.xy - epsilon ) );
|
---|
46 |
|
---|
47 | if (value.w != 0.0)
|
---|
48 | {
|
---|
49 | float2 newcoord = (float2(1.0, 1.0) - value.zw) + ((coords * sourceTextureSize) / sqrtNumSamples);
|
---|
50 | ocolor = float4(tex2D(tex1, newcoord).xyzw);
|
---|
51 | }
|
---|
52 | return ocolor;
|
---|
53 | //return tex2D(tex1, input.texCoord0);
|
---|
54 | }
|
---|
55 |
|
---|
56 | ///////////////////////////////////////////////////////////////////////////////
|
---|