Changeset 3630 for trunk/packages/vizservers/nanovis/shaders/vertex_std.cg
- Timestamp:
- Apr 16, 2013, 12:52:20 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/packages/vizservers/nanovis/shaders/vertex_std.cg
r3177 r3630 1 1 /* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- */ 2 2 /* 3 * ====================================================================== 4 * AUTHOR: Wei Qiao <qiaow@purdue.edu> 5 * Purdue Rendering and Perceptualization Lab (PURPL) 3 * Copyright (c) 2004-2013 HUBzero Foundation, LLC 6 4 * 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 * ====================================================================== 5 * Authors: 6 * Wei Qiao <qiaow@purdue.edu> 12 7 */ 13 8 … … 16 11 v2f main(a2v IN, 17 12 uniform float4x4 modelViewProjMatrix, 18 uniform float4x4 modelViewInv) 13 uniform float4x4 modelViewInv, 14 uniform float4 light0Position, 15 uniform float4 objPlaneS, 16 uniform float4 objPlaneT, 17 uniform float4 objPlaneR) 19 18 { 20 19 v2f OUT; … … 24 23 float4 eyePosObjSpace = mul(modelViewInv, float4(0,0,0,1)); 25 24 26 //clip space vertex position 27 //OUT.HPosition = mul(modelViewProjMatrix, mul(modelViewInv, IN.Position)); 25 // Clip space vertex position 28 26 OUT.HPosition = mul(modelViewProjMatrix, objPos); 29 27 30 //eye space texture coordinates 31 OUT.TexCoord = IN.TexCoord; 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 32 33 //world space eye position 34 //OUT.EyeVector = normalize(-IN.Position.xyz); 33 // World space eye position 35 34 OUT.EyeVector = normalize(eyePosObjSpace - objPos); 36 35 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); 36 // World space light postion (light0Position is in eye coords) 37 OUT.Light = normalize(mul(modelViewInv, light0Position)-objPos); 40 38 41 39 return OUT;
Note: See TracChangeset
for help on using the changeset viewer.