Last active
August 29, 2015 14:01
-
-
Save Meisaka/2c8d85698c0741db7412 to your computer and use it in GitHub Desktop.
some shaders
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
// fragment shader | |
#version 130 | |
in vec4 ex_color; | |
in vec3 ex_nvect; | |
in vec3 ex_cvect; | |
in vec2 ex_tex1; | |
out vec4 end_result; | |
void main(void) | |
{ | |
vec4 tci; | |
tci = ex_color * vec2(dot(ex_cvect,ex_nvect),0.0).xxxx; | |
end_result = vec4(tci.xyz,1.0); | |
} |
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
// vertex shader | |
#version 330 | |
in vec3 pos; | |
in vec3 norm; | |
in vec4 color; | |
in vec2 tex1; | |
uniform mat4 projection; | |
uniform mat4 view; | |
out vec4 ex_color; | |
out vec3 ex_nvect; | |
out vec3 ex_cvect; | |
out vec2 ex_tex1; | |
void main(void) | |
{ | |
vec4 v_pos; | |
v_pos = view * vec4(pos, 1.0); | |
ex_cvect = normalize(vec3(0,0,0)-v_pos.xyz); | |
ex_nvect = normalize((view * vec4(norm+pos,1)) - v_pos).xyz; | |
ex_color = color; | |
ex_tex1 = tex1; | |
gl_Position = projection * v_pos; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment