--- cvsroot/libgender/material.C 2005/02/07 08:51:18 1.58 +++ cvsroot/libgender/material.C 2005/02/08 05:55:28 1.59 @@ -142,6 +142,46 @@ { } + +void mat_timed::enable (view &ctx) +{ + material::enable (ctx); + + time->set ((GLfloat) ((int)timer::now % 100)); + sh_colour->set (vec3 (255, 0, 0) * (1.F / 255.F)); +} + +void mat_timed::disable (view &ctx) +{ + material::disable (ctx); +} + +void mat_timed::vsh (view &ctx) +{ + using namespace shader::compile; + std_vsh (); + + if (ctx.pass->l) + f_normal = normal_matrix * vin.normal; +} + +void mat_timed::fsh (view &ctx) +{ + using namespace shader::compile; + + if (ctx.pass->l) + { + temp_1f fac; + + fac = dot (normalize (f_normal), normalize (ctx.pass->l->sh_lightvec)); + + //fac = (fac / 100) * (mod (time, 100)) ; + fac = time; + + xyz (fout.frag_color) = float3 ((255/100) * fac, fac, fac);//ctx.pass->l->sh_colour * sh_colour * fac; + } +} + void mat_gouraud_shaded::enable (view &ctx) { material::enable (ctx); @@ -237,4 +277,5 @@ test_material *testmat; mat_gouraud_shaded *testmat2; +mat_timed *testmat3;