--- cvsroot/libgender/material.C 2004/10/30 00:17:28 1.20 +++ cvsroot/libgender/material.C 2004/10/30 15:59:20 1.21 @@ -97,6 +97,7 @@ vout.position = wpos; vout.tex_coord[0] = vin.tex_coord[0]; vout.tex_coord[1] = model_view_matrix * shader::compile::vec4 (x(vin.normal), y(vin.normal), z(vin.normal), 0); + vout.tex_coord[2] = lightpos - model_view_matrix * vin.vertex; p.vsh->end (); p.vsh->compile (); @@ -105,9 +106,9 @@ temp_1f fac; - fac = max (dot (fin.tex_coord[1], lightpos), 0.0); - fac = pow (fac, 3); - xyz (fout.frag_color) = texture_2d (texvar, fin.tex_coord[0]) * (fac + 0.3); + fac = max (dot (normalize (fin.tex_coord[1]), normalize (fin.tex_coord[2])), 0.0); + fac = pow (fac, 0.5); + xyz (fout.frag_color) = texture_2d (texvar, fin.tex_coord[0]) * max (fac, 0.4); p.fsh->end (); p.fsh->compile (); @@ -117,7 +118,7 @@ void test_material::enable (view &ctx) { p.enable (); - lightpos->set (-ctx.d); + lightpos->set (vec3 (0, 0, 0)); texvar->enable (); }