Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: data/branches/Shader_HS18/programs/GLSL150/pssmReceiverVp.glsl @ 12181

Last change on this file since 12181 was 12115, checked in by wiesep, 6 years ago

Changed folder structure, deletet some unused files and cleaned up code

File size: 1.2 KB
Line 
1#version 150
2
3uniform vec4 lightPosition;                             // object space
4uniform vec3 eyePosition;                                       // object space
5uniform mat4 worldViewProjMatrix;
6uniform mat4 texWorldViewProjMatrix0;
7uniform mat4 texWorldViewProjMatrix1;
8uniform mat4 texWorldViewProjMatrix2;
9
10out vec4 oUv0;
11out vec3 oLightDir;
12out vec3 oHalfAngle;
13out vec4 oLightPosition0;
14out vec4 oLightPosition1;
15out vec4 oLightPosition2;
16out vec3 oNormal;
17
18in vec4 position;
19in vec3 normal;
20in vec4 uv0;
21
22void main()
23{
24        // Calculate output position
25        gl_Position = worldViewProjMatrix * position;
26
27        // Pass the main uvs straight through unchanged
28        oUv0.xy = uv0.xy;
29        oUv0.z = gl_Position.z;
30
31        // Calculate tangent space light vector
32        // Get object space light direction
33        oLightDir = normalize(lightPosition.xyz - (position * lightPosition.w).xyz);
34
35        // Calculate half-angle in tangent space
36        vec3 eyeDir = normalize(eyePosition - position.xyz);
37        oHalfAngle = normalize(eyeDir + oLightDir);     
38
39        // Calculate the position of vertex in light space
40        oLightPosition0 = texWorldViewProjMatrix0 * position;
41        oLightPosition1 = texWorldViewProjMatrix1 * position;
42        oLightPosition2 = texWorldViewProjMatrix2 * position;
43
44        oNormal = normal;
45}
Note: See TracBrowser for help on using the repository browser.