Commit a4f4b275 authored by Romain Pacanowski's avatar Romain Pacanowski

WIP. to debug

parent ed51d961
......@@ -3,32 +3,37 @@
in vec3 v_color;
in vec3 v_normal;
in vec3 v_view;
in vec3 v_tangent;
uniform vec3 lightDir;
// uniform vec3 lightDir;
out vec4 out_color;
vec3 blinn(vec3 n, vec3 v, vec3 l, vec3 dCol, vec3 sCol, float s)
{
vec3 res = vec3(0,0,0);
float dc = max(0,dot(n,l));
if(dc>0) {
res = dCol * dc;
float sc = max(0,dot(n,normalize(v+l)));
if(sc>0)
res += sCol * pow(sc,s) * dc;
}
return res;
}
// vec3 blinn(vec3 n, vec3 v, vec3 l, vec3 dCol, vec3 sCol, float s)
// {
// vec3 res = vec3(0,0,0);
// float dc = max(0,dot(n,l));
// if(dc>0) {
// res = dCol * dc;
// float sc = max(0,dot(n,normalize(v+l)));
// if(sc>0)
// res += sCol * pow(sc,s) * dc;
// }
// return res;
// }
void main(void) {
float ambient = 0.0;
float shininess = 50;
vec3 spec_color = vec3(1,1,1);
// float ambient = 0.0;
// float shininess = 50;
// vec3 spec_color = vec3(1,1,1);
//out_color = vec4(ambient * v_color + blinn(normalize(v_normal),normalize(v_view), lightDir, v_color, spec_color, shininess),1.0);
//out_color = vec4(ambient + blinn(normalize(v_normal),normalize(v_view), lightDir, v_color, spec_color, shininess),1.0);
out_color.xyz = normalize(v_normal)*vec3(0.5) + vec3(0.5) ;
out_color.w = 1.0;
// out_color.xyz = vec3( 1.0, 0.0, 0.0);
//normalize(v_tangent)*vec3(0.5) + vec3(0.5);
}
......@@ -8,15 +8,19 @@ uniform mat3 normal_mat;
in vec3 vtx_position;
in vec3 vtx_color;
in vec3 vtx_normal;
in vec3 vtx_tangent;
out vec3 v_normal;
out vec3 v_view;
out vec3 v_color;
out vec3 v_tangent;
void main()
{
v_color = vtx_color;
v_normal = normalize(normal_mat * vtx_normal);
v_tangent = normalize(normal_mat * vtx_tangent);
vec4 p = view_mat * (obj_mat * vec4(vtx_position, 1.));
v_view = normalize(-p.xyz);
gl_Position = proj_mat * p;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment