Created
May 27, 2021 10:06
-
-
Save anirul/707d1c5ee8b9c46c7b7b8d6c5f78cd89 to your computer and use it in GitHub Desktop.
Light fragment shader
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 450 core | |
layout(location = 0) in vec3 aPos; | |
layout(location = 1) in vec3 aNormal; | |
layout(location = 2) in vec2 aTex; | |
out vec3 out_position; | |
out vec3 out_normal; | |
out vec2 out_tex; | |
out vec3 out_camera; | |
uniform mat4 model; | |
uniform mat4 view; | |
uniform mat4 projection; | |
uniform mat4 inv_model; | |
uniform vec3 camera_position; | |
void main() | |
{ | |
// mat3 inv_model = mat3(transpose(inverse(model))); | |
mat4 pvm = projection * view * model; | |
out_position = (view * model * vec4(aPos, 1.0)).xyz; | |
gl_Position = pvm * vec4(aPos, 1.0); | |
out_tex = aTex; | |
out_normal = vec3(inv_model * vec4(aNormal, 1.0)); | |
out_camera = camera_position; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment