1 | /* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- */ |
---|
2 | #include "particlemacro.h" |
---|
3 | #include "particle_common.cg" |
---|
4 | |
---|
5 | #ifdef USE_TIME_SERIES |
---|
6 | #define LEVEL1 0.5 |
---|
7 | #define LEVEL2 0.4 |
---|
8 | #else |
---|
9 | #define LEVEL1 0.7 |
---|
10 | #define LEVEL2 0.5 |
---|
11 | #endif |
---|
12 | |
---|
13 | float4 fpmain(float2 texCoord : TEXCOORD0, |
---|
14 | float3 color : COLOR, |
---|
15 | float2 center : TEXCOORD2, |
---|
16 | float4 rotation : TEXCOORD3, |
---|
17 | float skip : TEXCOORD4, |
---|
18 | float mag : TEXCOORD5, |
---|
19 | float zValue : TEXCOORD6, |
---|
20 | uniform sampler2D arrows : register(s0)) : COLOR |
---|
21 | { |
---|
22 | if (skip > 0.5) { |
---|
23 | discard; |
---|
24 | } |
---|
25 | |
---|
26 | float2 newTexCoord = float2((texCoord.x - 0.5) / NUM_SUBIMAGE_X, (texCoord.y - 0.5) / NUM_SUBIMAGE_Y); |
---|
27 | float2 rotTexCoord; |
---|
28 | rotTexCoord.x = rotation.x * newTexCoord.x + rotation.y * newTexCoord.y; |
---|
29 | rotTexCoord.y = rotation.z * newTexCoord.x + rotation.w * newTexCoord.y; |
---|
30 | rotTexCoord.x = rotTexCoord.x + 0.5 / NUM_SUBIMAGE_X; |
---|
31 | rotTexCoord.y = rotTexCoord.y + 0.5 / NUM_SUBIMAGE_Y; |
---|
32 | rotTexCoord = rotTexCoord + center; |
---|
33 | float4 refColor; |
---|
34 | #ifdef USE_J_WIRE |
---|
35 | if (mag > 0.2) |
---|
36 | refColor = float4(1, 0, 0, 1.0); |
---|
37 | else if (mag > 0.1) |
---|
38 | refColor = float4(1, 1, 0, 0.3); |
---|
39 | else |
---|
40 | refColor = float4(1, 1, 1, 0.3); |
---|
41 | #else |
---|
42 | if (mag > LEVEL1) |
---|
43 | refColor = float4(1, 0, 0, 1.0); |
---|
44 | //refColor = float4(1, 0, 0, 1.0 * (3.0 + zValue) / 3); |
---|
45 | else if (mag > LEVEL2) |
---|
46 | refColor = float4(1, 1, 0, 0.3); |
---|
47 | //refColor = float4(1, 1, 0, 1.0); |
---|
48 | else |
---|
49 | refColor = float4(0.5, 0.5, 0.5, 0.2); |
---|
50 | //refColor = float4(0.5, 0.5, 0.5, 1.0); |
---|
51 | #endif |
---|
52 | float4 arrowc = tex2D(arrows, rotTexCoord.xy); |
---|
53 | float4 c = float4(arrowc.xyz, ((arrowc.w == 1.0)? 1 : 0)); |
---|
54 | //float4 c = float4(arrowc.xyz, ((arrowc.w != 0.0)? 1 : 0)); |
---|
55 | |
---|
56 | return c * refColor; |
---|
57 | } |
---|