source: nanovis/trunk/shaders/renderparticle.cg @ 4795

Last change on this file since 4795 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.1 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
9void main(in float4 posin : POSITION,
10          in float4 colin : COLOR0,
11          out float psize : PSIZE,
12          out float4 posout : POSITION,
13          out float4 colout : COLOR0,
14          uniform float atten,
15          //uniform sampler2D normal,
16          uniform float4 posoffset,
17          uniform float4 basepos,
18          uniform float4 scale,
19          uniform float4x4 modelview,
20          uniform float4x4 projection)
21{
22    float4 vec, homeye, eye;
23    vec.xyz = posin.xyz;
24    vec.w = 1.0;
25    homeye = mul(modelview, vec);
26    posout = mul(projection, homeye);
27
28    float4 p = mul(modelview, vec);
29    //psize = scale.x   *(p.w / -p.z) * 10;
30
31    //psize = 5 * scale.x;
32    //psize = 2 * p.w / -p.z;
33    //colout = float4(colin.xyz,0.1);
34
35    float tmp = posin.w * rsqrt(dot(eye.xyz, eye.xyz));
36    psize = scale.x * max(tmp, 1.0);
37    psize = 10 * p.w / -p.z;
38
39    colout = float4(colin.xyz, colin.w * 0.25);
40}
Note: See TracBrowser for help on using the repository browser.