source: nanovis/trunk/shaders/vertex_std.cg @ 4880

Last change on this file since 4880 was 3630, checked in by ldelgass, 7 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
9#include "common.cg"
10 
11v2f main(a2v IN,
12         uniform float4x4 modelViewProjMatrix,
13         uniform float4x4 modelViewInv,
14         uniform float4 light0Position,
15         uniform float4 objPlaneS,
16         uniform float4 objPlaneT,
17         uniform float4 objPlaneR)
18{
19    v2f OUT;
20
21    // IN.Position is in eye coords
22    float4 objPos = mul(modelViewInv, IN.Position);
23    float4 eyePosObjSpace = mul(modelViewInv, float4(0,0,0,1));
24
25    // Clip space vertex position
26    OUT.HPosition = mul(modelViewProjMatrix, objPos);
27
28    // Generate world space texture coordinates
29    OUT.TexCoord.x = dot(objPos, objPlaneS);
30    OUT.TexCoord.y = dot(objPos, objPlaneT);
31    OUT.TexCoord.z = dot(objPos, objPlaneR);
32
33    // World space eye position
34    OUT.EyeVector = normalize(eyePosObjSpace - objPos);
35
36    // World space light postion (light0Position is in eye coords)
37    OUT.Light = normalize(mul(modelViewInv, light0Position)-objPos);
38
39    return OUT;
40}
Note: See TracBrowser for help on using the repository browser.