source: nanovis/branches/1.1/shaders/vertex_std.cg @ 4883

Last change on this file since 4883 was 3177, checked in by mmc, 12 years ago

Updated all of the copyright notices to reference the transfer to
the new HUBzero Foundation, LLC.

File size: 1.3 KB
Line 
1/* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- */
2/*
3 * ======================================================================
4 *  AUTHOR:  Wei Qiao <qiaow@purdue.edu>
5 *           Purdue Rendering and Perceptualization Lab (PURPL)
6 *
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 * ======================================================================
12 */
13
14#include "common.cg"
15 
16v2f main(a2v IN,
17         uniform float4x4 modelViewProjMatrix,
18         uniform float4x4 modelViewInv)
19{
20    v2f OUT;
21
22    // IN.Position is in eye coords
23    float4 objPos = mul(modelViewInv, IN.Position);
24    float4 eyePosObjSpace = mul(modelViewInv, float4(0,0,0,1));
25
26    //clip space vertex position
27    //OUT.HPosition = mul(modelViewProjMatrix, mul(modelViewInv, IN.Position));
28    OUT.HPosition = mul(modelViewProjMatrix, objPos);
29
30    //eye space texture coordinates
31    OUT.TexCoord = IN.TexCoord;
32
33    //world space eye position
34    //OUT.EyeVector = normalize(-IN.Position.xyz);
35    OUT.EyeVector = normalize(eyePosObjSpace - objPos);
36
37    //world space light postion
38    //OUT.Light = normalize(float3(1,1,1)-IN.Position.xyz);
39    OUT.Light = normalize(mul(modelViewInv, float4(1,1,1,1))-objPos);
40
41    return OUT;
42}
Note: See TracBrowser for help on using the repository browser.