source: GTP/trunk/App/Demos/Illum/IBRBillboardCloudTrees/OGRE/IBRTreesOGRE/media/oldgeneral/tree_idtexturing_vp.shd @ 1493

Revision 1493, 1.8 KB checked in by igarcia, 18 years ago (diff)
Line 
1float distanceScale;
2float4 lightPosition;
3float4 camera_pos;
4float4x4 worldviewproj;
5float4x4 proj_matrix;
6
7/*
8struct VS_OUTPUT {
9   float4 Pos:       POSITION;
10   float3 normal:    TEXCOORD0;
11   float3 lightVec : TEXCOORD1;
12   float3 viewVec:   TEXCOORD2;
13   float4 shadowCrd: TEXCOORD3;
14   float2 texCoord:  TEXCOORD4;
15   float2 texCoordNormalized: TEXCOORD5;
16};
17
18VS_OUTPUT main_vp(
19      float4 position : POSITION,
20      float4 normal : NORMAL,
21      float2 texCoord : TEXCOORD0,
22      float2 texCoordNormalized : TEXCOORD1)
23{
24        VS_OUTPUT Out;
25
26        Out.Pos = mul(worldviewproj, position);
27        // World-space lighting
28        Out.normal = normal;
29        Out.lightVec = distanceScale * (lightPosition - position.xyz);
30        Out.viewVec = camera_pos - position.xyz;
31        Out.texCoord = texCoord;
32        Out.texCoordNormalized = texCoordNormalized;
33
34           // Project it. For this sample using the normal projection
35           // matrix suffices, however, real applications will typically
36           // use a separate projection matrix for each light depending
37           // on its properties such as FOV and range.
38           float4 sPos = mul(proj_matrix, Pos);
39
40           // Use projective texturing to map the position of each fragment
41           // to its corresponding texel in the shadow map.
42           sPos.z += 10;
43           Out.shadowCrd.x = 0.5 * (sPos.z + sPos.x);
44           Out.shadowCrd.y = 0.5 * (sPos.z - sPos.y);
45           Out.shadowCrd.z = 0;
46           Out.shadowCrd.w = sPos.z;
47
48           return Out;
49}
50*/
51struct VS_OUTPUT {
52   float4 Pos:       POSITION;
53   float2 texCoord:    TEXCOORD0;
54   float2 texCoordNormalized : TEXCOORD1;
55};
56
57VS_OUTPUT main_vp(
58      float4 position : POSITION,
59      float2 texCoord : TEXCOORD0,
60      float2 texCoordNormalized : TEXCOORD1)
61{
62        VS_OUTPUT Out;
63
64        Out.Pos = mul(worldviewproj, position);
65        Out.texCoord = texCoord;
66        Out.texCoordNormalized = texCoordNormalized;
67         
68           return Out;
69}
Note: See TracBrowser for help on using the repository browser.