comparison Renderer/Engine/spe/DrawSpan.cc @ 1144:e068c1269292 draft

light fix
author Yutaka_Kinjyo
date Sat, 19 Feb 2011 03:54:12 +0900
parents 2a63ba2c9506
children 4e898dca4ab9
comparison
equal deleted inserted replaced
1143:786e800abfb4 1144:e068c1269292
450 {world_x, world_y, -world_z, 0}, 450 {world_x, world_y, -world_z, 0},
451 {world_x, world_y, -world_z, 0}}; 451 {world_x, world_y, -world_z, 0}};
452 452
453 453
454 int light_rgb; 454 int light_rgb;
455 float inner_product; 455 float inner_product = 0.2;
456 456
457 normalize(normal_vector, normal_vector); 457 normalize(normal_vector, normal_vector);
458 458
459 vector float vtmp_rgb __attribute__((aligned(16))) = {0,0,0,0}; 459 vector float vtmp_rgb __attribute__((aligned(16))) = {0,0,0,0};
460 460
464 for (int i = 0; i < light_num; i++) { 464 for (int i = 0; i < light_num; i++) {
465 465
466 if (light_switch[i] == 1) { 466 if (light_switch[i] == 1) {
467 light_vector = spu_sub(v_world[i],light_xyz[i]); 467 light_vector = spu_sub(v_world[i],light_xyz[i]);
468 normalize(light_vector, light_vector); 468 normalize(light_vector, light_vector);
469 inner_product = innerProduct1(normal_vector,light_vector); 469 float tmp_inner_product = innerProduct1(normal_vector,light_vector);
470
471 if (inner_product < tmp_inner_product) {
472 inner_product = tmp_inner_product;
473 }
474
470 v_inner = spu_splats(inner_product); 475 v_inner = spu_splats(inner_product);
471 vtmp_rgb = spu_madd(v_rgb,v_inner,vtmp_rgb); 476 vtmp_rgb = spu_madd(v_rgb,v_inner,vtmp_rgb);
472 } 477 }
473 478
474 } 479 }