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

Comparing libgender/material.C (file contents):
Revision 1.65 by root, Tue Aug 9 23:58:43 2005 UTC vs.
Revision 1.66 by root, Wed Jan 25 22:48:02 2006 UTC

113 ctx.pass->l->fsh (); 113 ctx.pass->l->fsh ();
114 fsh (ctx); 114 fsh (ctx);
115 } 115 }
116 else 116 else
117 // many drivers need both vertex and fragment shader, 'caboom!' otherwise 117 // many drivers need both vertex and fragment shader, 'caboom!' otherwise
118 shader::compile::fout.frag_color = shader::compile::float4 (0., 0., 0., 0.); 118 shader::compile::fout.frag_color = shader::compile::vec4 (0., 0., 0., 0.);
119 119
120 fsh_src = shader::shader_builder::stop (); 120 fsh_src = shader::shader_builder::stop ();
121 121
122 shader::program_object po = shader::get_program (vsh_src, fsh_src); 122 shader::program_object po = shader::get_program (vsh_src, fsh_src);
123 matmap.insert (pass_data::matmap_t::value_type (this, po)); 123 matmap.insert (pass_data::matmap_t::value_type (this, po));
207 207
208 normal = f_normal + 0.3 * pow (sin (f_normal * 3.14159 + time), 3); 208 normal = f_normal + 0.3 * pow (sin (f_normal * 3.14159 + time), 3);
209 209
210 fac = dot (normalize (normal), normalize (ctx.pass->l->sh_lightvec)); 210 fac = dot (normalize (normal), normalize (ctx.pass->l->sh_lightvec));
211 211
212 xyz (fout.frag_color) = fac * float3 (0.1,0.5,1);//ctx.pass->l->sh_colour * sh_colour * fac; 212 xyz (fout.frag_color) = fac * shader::compile::vec3 (0.1,0.5,1);//ctx.pass->l->sh_colour * sh_colour * fac;
213 } 213 }
214} 214}
215 215
216void mat_gouraud_shaded::enable (view &ctx) 216void mat_gouraud_shaded::enable (view &ctx)
217{ 217{
284 { 284 {
285 temp_1f fac; 285 temp_1f fac;
286 286
287 fac = dot (normalize (f_normal), normalize (ctx.pass->l->sh_lightvec)); 287 fac = dot (normalize (f_normal), normalize (ctx.pass->l->sh_lightvec));
288 288
289 xyz (fout.frag_color) = float3 (1.,0.,0.); 289 xyz (fout.frag_color) = shader::compile::vec3 (1.,0.,0.);
290 w (fout.frag_color) = 0.1; 290 w (fout.frag_color) = 0.1;
291 } 291 }
292} 292}
293 293
294static shader::varying_2f texcoord; 294static shader::varying_2f texcoord;
320 320
321 yxz (rot1) = (texture_2d (normvar, texcoord) * 2.F - 1.F); 321 yxz (rot1) = (texture_2d (normvar, texcoord) * 2.F - 1.F);
322 322
323 //rot1 = normal_matrix * rot1; 323 //rot1 = normal_matrix * rot1;
324 324
325 rot2 = float3 (x(rot1), z(rot1), -y(rot1)); 325 rot2 = shader::compile::vec3 (x(rot1), z(rot1), -y(rot1));
326 rot3 = float3 (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);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines