summaryrefslogtreecommitdiff
path: root/data/shaders/phong-vert.glsl
diff options
context:
space:
mode:
authorDavid Thompson <dthompson2@worcester.edu>2021-05-14 21:28:30 -0400
committerDavid Thompson <dthompson2@worcester.edu>2021-05-14 21:32:11 -0400
commit168b0f8cb9bdcf9d1983aee5c89543bb940790ef (patch)
tree2e746fbabce97c18c95b16e50a6b4ffb332dc476 /data/shaders/phong-vert.glsl
parent955471b2ce3d7f393c6af11ff5de5a6965ad5200 (diff)
graphics: phong: Respect the user defined lights passed to draw-model.
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);
}