Created
February 6, 2017 21:30
-
-
Save recp/6a426359260947d8940d3aa742f7d035 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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