Last change
on this file since 12202 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 | |
---|
3 | uniform vec4 lightPosition; // object space |
---|
4 | uniform vec3 eyePosition; // object space |
---|
5 | uniform mat4 worldViewProjMatrix; |
---|
6 | uniform mat4 texWorldViewProjMatrix0; |
---|
7 | uniform mat4 texWorldViewProjMatrix1; |
---|
8 | uniform mat4 texWorldViewProjMatrix2; |
---|
9 | |
---|
10 | out vec4 oUv0; |
---|
11 | out vec3 oLightDir; |
---|
12 | out vec3 oHalfAngle; |
---|
13 | out vec4 oLightPosition0; |
---|
14 | out vec4 oLightPosition1; |
---|
15 | out vec4 oLightPosition2; |
---|
16 | out vec3 oNormal; |
---|
17 | |
---|
18 | in vec4 position; |
---|
19 | in vec3 normal; |
---|
20 | in vec4 uv0; |
---|
21 | |
---|
22 | void 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.