Ignore:
Timestamp:
Apr 16, 2013 12:52:20 AM (7 years ago)
Author:
ldelgass
Message:

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:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/packages/vizservers/nanovis/shaders/update_pos.cg

    r3177 r3630  
    11/* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- */
    22/*
    3  * ======================================================================
    4  *  AUTHOR:  Wei Qiao <qiaow@purdue.edu>
    5  *           Purdue Rendering and Perceptualization Lab (PURPL)
     3 * Copyright (c) 2004-2013  HUBzero Foundation, LLC
    64 *
    7  *  Copyright (c) 2004-2012  HUBzero Foundation, LLC
    8  *
    9  *  See the file "license.terms" for information on usage and
    10  *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
    11  * ======================================================================
     5 * Authors:
     6 *   Wei Qiao <qiaow@purdue.edu>
    127 */
    138
     
    2015            uniform samplerRECT init_pos_tex,
    2116            uniform sampler3D vel_tex,
    22             // uniform sampler1D tf_tex,
    2317            uniform float timestep,
    2418            uniform float max,
    25             uniform float mode,
    2619            uniform float3 scale) : COLOR
    2720{
    2821    float4 ret;
    29     /*
    30       if (mode == 0) {
    31           float4 pos = texRECT(pos_tex, uv);
    32           float4 vel = tex3D(vel_tex, pos.xyz);
    33           ret.xyz = tex1D(tf_tex, vel.x).xyz;
    34           ret.w = 1;
    35       } else {
    36     */
    3722    // get previous position
    3823    float4 pos = texRECT(pos_tex, uv);
    3924    float time = pos.w;
    4025
     26    //reconstruct negative value
     27    if (max > 0) {
    4128#ifdef EXPIRE
    42     time -= timestep;
     29        time -= timestep;
    4330
    44     // Lifetime ended?
    45     if (time < 0) {
    46         return texRECT(init_pos_tex, uv);
     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;
    4742    }
    48 #endif
    49 
    50     //reconstruct negative value
    51     float4 vel = float4(tex3D(vel_tex, pos.xyz).yzw, 0.0) * 2.0 - float4(1.0, 1.0, 1.0, 0.0f);
    52     vel = vel * max;
    53     //vel *= float4(scale, 1);
    54     ret = pos + (vel * timestep);
    5543
    5644    //not drawing if the particle is out of bound
     
    6048        ret.w = time;
    6149    }
    62 //    }
    6350
    6451    return ret;
Note: See TracChangeset for help on using the changeset viewer.