Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: data/branches/Shader_HS18/programs/Example/GLSLES/varianceshadowcastervp.glsles @ 12091

Last change on this file since 12091 was 12091, checked in by wiesep, 5 years ago

Updated programs and adjusted Material to work with GLSL>150

File size: 3.0 KB
Line 
1/////////////////////////////////////////////////////////////////////////////////
2//
3// shadowcastervp.cg
4//
5// Hamilton Chong
6// (c) 2006
7//
8// This is an example vertex shader for shadow caster objects. 
9//
10/////////////////////////////////////////////////////////////////////////////////
11
12
13// Define inputs from application.
14struct VertexIn
15{
16  float4 position : POSITION;       // vertex position in object space
17  float4 normal   : NORMAL;         // vertex normal in object space
18};
19
20// Define outputs from vertex shader.
21struct VertexOut
22{
23  float4 position   : POSITION;     // post projection position coordinates
24  float4 pos        : TEXCOORD0;    // ditto. Not all hardware allows access values bound to POSITION in fp.
25  float4 normal     : TEXCOORD1;    // normal in object space (to be interpolated)
26  float4 modelPos   : TEXCOORD2;    // position in object space (to be interpolated)
27};
28
29VertexOut main( VertexIn         In,                   // vertex to process
30                uniform float4x4 uModelViewProjection  // model-view-projection matrix
31              )
32{
33    VertexOut Out;   // output data
34   
35    // Transform vertex position into post projective (homogenous screen) space.
36    Out.position = mul(uModelViewProjection, In.position);
37    Out.pos      = mul(uModelViewProjection, In.position);
38
39    // copy over data to interpolate using perspective correct interpolation
40    Out.normal = float4(In.normal.x, In.normal.y, In.normal.z, 0.0);
41    Out.modelPos = In.position;
42
43    return Out;
44}
45/////////////////////////////////////////////////////////////////////////////////
46//
47// shadowcastervp.cg
48//
49// Hamilton Chong
50// (c) 2006
51//
52// This is an example vertex shader for shadow caster objects. 
53//
54/////////////////////////////////////////////////////////////////////////////////
55
56
57// Define inputs from application.
58struct VertexIn
59{
60  float4 position : POSITION;       // vertex position in object space
61  float4 normal   : NORMAL;         // vertex normal in object space
62};
63
64// Define outputs from vertex shader.
65struct VertexOut
66{
67  float4 position   : POSITION;     // post projection position coordinates
68  float4 pos        : TEXCOORD0;    // ditto. Not all hardware allows access values bound to POSITION in fp.
69  float4 normal     : TEXCOORD1;    // normal in object space (to be interpolated)
70  float4 modelPos   : TEXCOORD2;    // position in object space (to be interpolated)
71};
72
73VertexOut main( VertexIn         In,                   // vertex to process
74                uniform float4x4 uModelViewProjection  // model-view-projection matrix
75              )
76{
77    VertexOut Out;   // output data
78   
79    // Transform vertex position into post projective (homogenous screen) space.
80    Out.position = mul(uModelViewProjection, In.position);
81    Out.pos      = mul(uModelViewProjection, In.position);
82
83    // copy over data to interpolate using perspective correct interpolation
84    Out.normal = float4(In.normal.x, In.normal.y, In.normal.z, 0.0);
85    Out.modelPos = In.position;
86
87    return Out;
88}
Note: See TracBrowser for help on using the repository browser.