Updated shaders with comments

This commit is contained in:
raysan5
2016-05-18 12:04:27 +02:00
parent 0e29aa2951
commit bc08271da3
34 changed files with 294 additions and 158 deletions

View File

@ -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);