ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/libgender/material.C
(Generate patch)

Comparing libgender/material.C (file contents):
Revision 1.66 by root, Wed Jan 25 22:48:02 2006 UTC vs.
Revision 1.67 by root, Wed Jan 25 22:52:26 2006 UTC

169 169
170void skybox_material::fsh (view &ctx) 170void skybox_material::fsh (view &ctx)
171{ 171{
172 using namespace shader::compile; 172 using namespace shader::compile;
173 173
174 xyz (fout.frag_color) = texture_2d (tex, skybox_texcoord); 174 xyz (fout.frag_color) = xyz (texture_2d (tex, skybox_texcoord));
175} 175}
176 176
177void mat_timed::enable (view &ctx) 177void mat_timed::enable (view &ctx)
178{ 178{
179 material::enable (ctx); 179 material::enable (ctx);
316 temp_3f lc; 316 temp_3f lc;
317 temp_1f fac; 317 temp_1f fac;
318 318
319 temp_3f rot1, rot2, rot3; 319 temp_3f rot1, rot2, rot3;
320 320
321 yxz (rot1) = (texture_2d (normvar, texcoord) * 2.F - 1.F); 321 yxz (rot1) = (xyz (texture_2d (normvar, texcoord)) * 2.F - 1.F);
322 322
323 //rot1 = normal_matrix * rot1; 323 //rot1 = normal_matrix * rot1;
324 324
325 rot2 = shader::compile::vec3 (x(rot1), z(rot1), -y(rot1)); 325 rot2 = shader::compile::vec3 (x(rot1), z(rot1), -y(rot1));
326 rot3 = shader::compile::vec3 (y(rot1), -x(rot1), z(rot1)); 326 rot3 = shader::compile::vec3 (y(rot1), -x(rot1), z(rot1));
327 327
328 normal = mat3 (rot1, rot2, rot3) * normal; 328 normal = mat3 (rot1, rot2, rot3) * normal;
329 329
330 fac = dot (normalize (normal), normalize (ctx.pass->l->sh_lightvec)); 330 fac = dot (normalize (normal), normalize (ctx.pass->l->sh_lightvec));
331 fac = max (pow (max (fac, 0.0), 6), 0.3); 331 fac = max (pow (max (fac, 0.0), 6), 0.3);
332 xyz (fout.frag_color) = (texture_2d (texvar, texcoord) + 0.2F) * fac 332 xyz (fout.frag_color) = xyz (texture_2d (texvar, texcoord) + 0.2F)
333 * fac
333 * ctx.pass->l->sh_colour; 334 * ctx.pass->l->sh_colour;
334 //xyz (fout.frag_color) = lc * fac; 335 //xyz (fout.frag_color) = lc * fac;
335 } 336 }
336} 337}
337 338

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines