aboutsummaryrefslogtreecommitdiff
path: root/shaders/glsl330/phong.vs
diff options
context:
space:
mode:
Diffstat (limited to 'shaders/glsl330/phong.vs')
-rw-r--r--shaders/glsl330/phong.vs14
1 files changed, 8 insertions, 6 deletions
diff --git a/shaders/glsl330/phong.vs b/shaders/glsl330/phong.vs
index ee6d34bf..d68d9b3f 100644
--- a/shaders/glsl330/phong.vs
+++ b/shaders/glsl330/phong.vs
@@ -1,23 +1,25 @@
#version 330
-// Vertex input data
+// Input vertex attributes
in vec3 vertexPosition;
in vec2 vertexTexCoord;
in vec3 vertexNormal;
-// Projection and model data
+// Input uniform values
uniform mat4 mvpMatrix;
-uniform mat4 modelMatrix;
-// Attributes to fragment shader
+// Output vertex attributes (to fragment shader)
out vec2 fragTexCoord;
out vec3 fragNormal;
+// NOTE: Add here your custom variables
+uniform mat4 modelMatrix;
+
void main()
{
- // Send texture coord to fragment shader
+ // Send vertex attributes to fragment shader
fragTexCoord = vertexTexCoord;
-
+
// Calculate view vector normal from model
mat3 normalMatrix = transpose(inverse(mat3(modelMatrix)));
fragNormal = normalize(normalMatrix*vertexNormal);