diff 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
line wrap: on
line diff
--- a/Renderer/Engine/spe/DrawSpan.cc	Sat Feb 19 01:59:14 2011 +0900
+++ b/Renderer/Engine/spe/DrawSpan.cc	Sat Feb 19 03:54:12 2011 +0900
@@ -452,7 +452,7 @@
 
 
     int light_rgb;
-    float inner_product;
+    float inner_product = 0.2;
 
     normalize(normal_vector, normal_vector);
 
@@ -466,7 +466,12 @@
       if (light_switch[i] == 1) {
           light_vector = spu_sub(v_world[i],light_xyz[i]);
 	  normalize(light_vector, light_vector);
-	  inner_product = innerProduct1(normal_vector,light_vector);
+	  float tmp_inner_product = innerProduct1(normal_vector,light_vector);
+
+	  if (inner_product < tmp_inner_product) {
+	    inner_product = tmp_inner_product;
+	  }
+
 	  v_inner = spu_splats(inner_product);
 	  vtmp_rgb = spu_madd(v_rgb,v_inner,vtmp_rgb);
       }