Last change
on this file since 4822 was
3630,
checked in by ldelgass, 11 years ago
|
Nanovis refactoring to fix problems with scaling and multiple results.
Do rendering in world space to properly place and scale multiple data sets.
Also fix flows to reduce resets of animations. More work toward removing
Cg dependency. Fix panning to convert viewport coords to world coords.
|
File size:
1.3 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 | // update positions based on velocity |
---|
10 | |
---|
11 | #include "common.cg" |
---|
12 | |
---|
13 | float4 main(in float2 uv : TEXCOORD0, |
---|
14 | uniform samplerRECT pos_tex, |
---|
15 | uniform samplerRECT init_pos_tex, |
---|
16 | uniform sampler3D vel_tex, |
---|
17 | uniform float timestep, |
---|
18 | uniform float max, |
---|
19 | uniform float3 scale) : COLOR |
---|
20 | { |
---|
21 | float4 ret; |
---|
22 | // get previous position |
---|
23 | float4 pos = texRECT(pos_tex, uv); |
---|
24 | float time = pos.w; |
---|
25 | |
---|
26 | //reconstruct negative value |
---|
27 | if (max > 0) { |
---|
28 | #ifdef EXPIRE |
---|
29 | time -= timestep; |
---|
30 | |
---|
31 | // Lifetime ended? |
---|
32 | if (time < 0) { |
---|
33 | return texRECT(init_pos_tex, uv); |
---|
34 | } |
---|
35 | #endif |
---|
36 | float4 vel = float4(tex3D(vel_tex, pos.xyz).yzw, 0.0) * 2.0 - float4(1.0, 1.0, 1.0, 0.0); |
---|
37 | vel = vel * max; |
---|
38 | //vel *= float4(scale, 1); |
---|
39 | ret = pos + (vel * timestep); |
---|
40 | } else { |
---|
41 | ret = pos; |
---|
42 | } |
---|
43 | |
---|
44 | //not drawing if the particle is out of bound |
---|
45 | if (ret.x < 0 || ret.x > 1 || ret.y < 0 || ret.y > 1 || ret.z < 0 || ret.z > 1) { |
---|
46 | ret = texRECT(init_pos_tex, uv); |
---|
47 | } else { |
---|
48 | ret.w = time; |
---|
49 | } |
---|
50 | |
---|
51 | return ret; |
---|
52 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.