source: nanovis/branches/1.1/shaders/particlefp.cg @ 4906

Last change on this file since 4906 was 4904, checked in by ldelgass, 9 years ago

Merge serveral changes from trunk. Does not include threading, world space
changes, etc.

File size: 1.9 KB
Line 
1/* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- */
2/*
3 * Copyright (c) 2004-2013  HUBzero Foundation, LLC
4 *
5 * Authors:
6 *   Wei Qiao <qiaow@purdue.edu>
7 */
8
9#include "particle_common.cg"
10
11#ifdef USE_TIME_SERIES
12#define LEVEL1 0.5
13#define LEVEL2 0.4
14#else
15#define LEVEL1 0.7
16#define LEVEL2 0.5
17#endif
18
19float4 fpmain(float2 texCoord : TEXCOORD0,
20              float3 color : COLOR,
21              float2 center : TEXCOORD2,
22              float4 rotation : TEXCOORD3,
23              float skip : TEXCOORD4,
24              float mag : TEXCOORD5,
25              float zValue : TEXCOORD6,
26              uniform sampler2D arrows : register(s0)) : COLOR
27{
28    if (skip > 0.5) {
29        discard;
30    }
31
32    float2 newTexCoord = float2((texCoord.x - 0.5) / NUM_SUBIMAGE_X, (texCoord.y - 0.5) / NUM_SUBIMAGE_Y);
33    float2 rotTexCoord;
34    rotTexCoord.x = rotation.x * newTexCoord.x + rotation.y * newTexCoord.y;
35    rotTexCoord.y = rotation.z * newTexCoord.x + rotation.w * newTexCoord.y;
36    rotTexCoord.x = rotTexCoord.x + 0.5 / NUM_SUBIMAGE_X;
37    rotTexCoord.y = rotTexCoord.y + 0.5 / NUM_SUBIMAGE_Y;
38    rotTexCoord = rotTexCoord + center;
39    float4 refColor;
40#ifdef USE_J_WIRE       
41    if (mag > 0.2)
42        refColor = float4(1, 0, 0, 1.0);
43    else if (mag > 0.1)
44        refColor = float4(1, 1, 0, 0.3);
45    else
46        refColor = float4(1, 1, 1, 0.3);
47#else
48    if (mag > LEVEL1)
49        refColor = float4(1, 0, 0, 1.0);
50    //refColor = float4(1, 0, 0, 1.0 * (3.0 + zValue) / 3);
51    else if (mag > LEVEL2)
52        refColor = float4(1, 1, 0, 0.3);
53    //refColor = float4(1, 1, 0, 1.0);
54    else
55        refColor = float4(0.5, 0.5, 0.5, 0.2);
56    //refColor = float4(0.5, 0.5, 0.5, 1.0);
57#endif
58    float4 arrowc = tex2D(arrows, rotTexCoord.xy);
59    float4 c = float4(arrowc.xyz, ((arrowc.w == 1.0)? 1 : 0));
60    //float4 c = float4(arrowc.xyz, ((arrowc.w != 0.0)? 1 : 0));
61       
62    return c * refColor;
63}
Note: See TracBrowser for help on using the repository browser.