summaryrefslogtreecommitdiff
path: root/data/shaders/phong-vert.glsl
diff options
context:
space:
mode:
Diffstat (limited to 'data/shaders/phong-vert.glsl')
-rw-r--r--data/shaders/phong-vert.glsl6
1 files changed, 4 insertions, 2 deletions
diff --git a/data/shaders/phong-vert.glsl b/data/shaders/phong-vert.glsl
index 51461fa..9b72eb3 100644
--- a/data/shaders/phong-vert.glsl
+++ b/data/shaders/phong-vert.glsl
@@ -15,9 +15,11 @@ attribute vec3 normal;
#endif
#ifdef GLSL120
+varying vec3 fragWorldPos;
varying vec3 fragNorm;
varying vec2 fragTex;
#else
+out vec3 fragWorldPos;
out vec3 fragNorm;
out vec2 fragTex;
#endif
@@ -27,8 +29,8 @@ uniform mat4 view;
uniform mat4 projection;
void main() {
- gl_Position = projection * view * model * vec4(position, 1.0);
- // TODO: Calculate normal matrix on CPU
+ fragWorldPos = vec3(model * vec4(position, 1.0));
fragNorm = normalize(model * vec4(normal, 1.0)).xyz;
fragTex = texcoord;
+ gl_Position = projection * view * vec4(fragWorldPos, 1.0);
}