diff options
Diffstat (limited to 'shaders/final.vertex')
-rw-r--r-- | shaders/final.vertex | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/shaders/final.vertex b/shaders/final.vertex index 825eb49..dda8626 100644 --- a/shaders/final.vertex +++ b/shaders/final.vertex | |||
@@ -4,11 +4,28 @@ layout(location = 0) in vec3 vertexPosition_modelspace; | |||
4 | layout(location = 1) in vec3 vertexNormal; | 4 | layout(location = 1) in vec3 vertexNormal; |
5 | 5 | ||
6 | out vec2 UV; | 6 | out vec2 UV; |
7 | out vec3 norm; | 7 | out vec3 normIn; |
8 | out vec3 camDirIn; | ||
9 | out vec3 lightDirIn; | ||
10 | //out vec3 vertPos; | ||
11 | |||
12 | uniform mat4 MVP; | ||
13 | uniform mat4 worldMat; | ||
14 | |||
15 | const vec3 Tuning_LightPos = vec3(1, 1, 1.0); | ||
8 | 16 | ||
9 | void main() | 17 | void main() |
10 | { | 18 | { |
11 | gl_Position = vec4(vertexPosition_modelspace,1); | 19 | gl_Position = MVP * vec4(vertexPosition_modelspace,1); |
12 | UV = (vertexPosition_modelspace.xy+vec2(1,1))/2.0; | 20 | UV = (vertexPosition_modelspace.xy+vec2(1,1))/2.0; |
13 | norm = vertexNormal; | 21 | normIn = vertexNormal; |
22 | |||
23 | mat3 invWorldRot = transpose(mat3(worldMat[0].xyz, worldMat[1].xyz, worldMat[2].xyz)); | ||
24 | //mat3 invWorldRot = mat3(1.0f); | ||
25 | vec3 worldPos = (worldMat * vec4(vertexPosition_modelspace,1)).xyz; | ||
26 | camDirIn = invWorldRot * (vec3(0,0,1) - worldPos); | ||
27 | //camDir = worldPos; | ||
28 | lightDirIn = invWorldRot * (Tuning_LightPos - worldPos); | ||
29 | //vec4 vertPos4 = vec4(vertexPosition_modelspace,1); | ||
30 | //vertPos = vec3(vertPos4) / vertPos4.w; | ||
14 | } | 31 | } |