Skip to content

Instantly share code, notes, and snippets.

@recp
Created February 6, 2017 21:30
Show Gist options
  • Save recp/6a426359260947d8940d3aa742f7d035 to your computer and use it in GitHub Desktop.
Save recp/6a426359260947d8940d3aa742f7d035 to your computer and use it in GitHub Desktop.
#version 410
uniform mat4 MVP; // Projection * View * Model matrix
uniform mat4 MV; // View * Model Matrix
uniform mat4 NM; // Normal matrix
uniform int NMU; // Use normal matrix
layout(location = 0) in vec3 POSITION;
layout(location = 1) in vec3 NORMAL;
out vec3 vPosition;
out vec3 vNormal;
out vec3 vEye;
void main() {
vec4 pos4 = vec4(POSITION, 1.0);
vPosition = vec3(MV * pos4);
vEye = normalize(-vPosition);
if (NMU == 1)
vNormal = normalize(vec3(NM * vec4(NORMAL, 0.0)));
else
vNormal = normalize(vec3(MV * vec4(NORMAL, 0.0)));
gl_Position = MVP * pos4;
}
@recp
Copy link
Author

recp commented Nov 16, 2017

This shader is not used by libgk anymore!
Now there is a shader generator and shader manager for specific purposes/tasks

Check new version at: https://github.com/recp/libgk/tree/master/src/shader/glsl

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment