Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/Samples/Media/DeferredShadingMedia/DeferredShading/material/hlsl/nm_vs.hlsl @ 1

Last change on this file since 1 was 1, checked in by landauf, 17 years ago
File size: 2.1 KB
RevLine 
[1]1/******************************************************************************
2Copyright (c) W.J. van der Laan
3
4Permission is hereby granted, free of charge, to any person obtaining a copy of
5this software  and associated documentation files (the "Software"), to deal in
6the Software without restriction, including without limitation the rights to use,
7copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
8Software, and to permit persons to whom the Software is furnished to do so, subject
9to the following conditions:
10
11The above copyright notice and this permission notice shall be included in all copies
12or substantial portions of the Software.
13
14THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
15INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
16PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
17HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
18OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,OUT OF OR IN CONNECTION WITH THE
19SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20******************************************************************************/
21/** Deferred shading framework
22        // W.J. :wumpus: van der Laan 2005 //
23       
24        Material shader: Normal mapped
25*/
26struct VS_OUTPUT {
27   float4 pos: POSITION;
28   float4 normal: TEXCOORD0;
29   float2 texCoord0: TEXCOORD1;
30   float depth: TEXCOORD2;
31   float3 tangent: TEXCOORD3;
32   float3 binormal: TEXCOORD4;
33};
34
35float4x4 worldViewProj;
36float4x4 world;
37float4x4 worldView;
38
39VS_OUTPUT main(
40        float4 Pos: POSITION,
41        float3 normal: NORMAL,
42        float2 texCoord0: TEXCOORD0,
43        float3 tangent: TANGENT0
44){
45   VS_OUTPUT Out;
46   
47   Out.normal = mul(worldView, normal);
48   float4 projPos = mul(worldViewProj, Pos);
49   
50   Out.tangent = mul(worldView, tangent);
51   Out.binormal = cross(Out.normal, Out.tangent);
52   
53   Out.pos = projPos;
54   Out.texCoord0 = texCoord0;
55   Out.depth = projPos.w;
56   //Out.depth = projPos.z/projPos.w;
57
58   return Out;
59}
60
61
Note: See TracBrowser for help on using the repository browser.