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