source: nanovis/branches/1.1/shaders/pointsvp.cg @ 4923

Last change on this file since 4923 was 4904, checked in by ldelgass, 10 years ago

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

File size: 1.7 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 modelViewProj)
21{
22    float4 vec, homeye, eye;
23    vec.xyz = posin.xyz;
24    vec.w = 1.0;
25    homeye = mul(modelView, vec);
26    posout = mul(modelViewProj, posin);
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    /*
41      float4 vec, homeye, eye;
42      float tmp;
43
44      vec.xyz = posin.xyz;//(posin.xyz + posoffset.www) * basepos.www + basepos.xyz;
45      vec.w = 1.0;
46
47      homeye = mul(modelView, vec);
48      posout = mul(modelViewProj, posin);
49
50      //eye = homeye / homeye.w;
51
52      //tmp = posin.w * basepos.w * scale.w * rsqrt(atten * dot(eye.xyz, eye.xyz));
53
54      //psize = scale.x * max(tmp, 1.0);
55      //tmp = min(tmp, 1.0);
56      //colout = colin;
57      //tmp = colin.w * scale.z * tmp * tmp;
58      //colout.w = max(tmp, 4.0/256);
59
60      psize = 5.0;
61
62      colout = float4(0.0, 0.0, 1.0, 0.1);
63    */ 
64}
Note: See TracBrowser for help on using the repository browser.