Last change
on this file since 5428 was
4904,
checked in by ldelgass, 9 years ago
|
Merge serveral changes from trunk. Does not include threading, world space
changes, etc.
|
File size:
840 bytes
|
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 | |
---|
11 | v2f main(a2v IN, |
---|
12 | uniform float4x4 modelViewProjMatrix, |
---|
13 | uniform float4x4 modelViewInv) |
---|
14 | { |
---|
15 | v2f OUT; |
---|
16 | |
---|
17 | // IN.Position is in eye coords |
---|
18 | float4 objPos = mul(modelViewInv, IN.Position); |
---|
19 | float4 eyePosObjSpace = mul(modelViewInv, float4(0,0,0,1)); |
---|
20 | |
---|
21 | // Clip space vertex position |
---|
22 | OUT.HPosition = mul(modelViewProjMatrix, objPos); |
---|
23 | |
---|
24 | // Eye space texture coordinates |
---|
25 | OUT.TexCoord = IN.TexCoord; |
---|
26 | |
---|
27 | // World space eye position |
---|
28 | OUT.EyeVector = normalize(eyePosObjSpace - objPos); |
---|
29 | |
---|
30 | // World space light postion |
---|
31 | OUT.Light = normalize(mul(modelViewInv, float4(1,1,1,1))-objPos); |
---|
32 | |
---|
33 | return OUT; |
---|
34 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.