changeset 855:e2af25174a05

light fix--
author Yutaka_Kinjyo
date Thu, 10 Jun 2010 17:18:55 +0900
parents 6aa20c0dd8f8
children 413d9cddc798
files Renderer/Engine/spe/DrawSpan.cc Renderer/Engine/task/DrawSpan.cc Renderer/Test/universe.cc TaskManager/kernel/ppe/TaskManagerImpl.cc
diffstat 4 files changed, 11 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/Renderer/Engine/spe/DrawSpan.cc	Wed Jun 09 23:04:09 2010 +0900
+++ b/Renderer/Engine/spe/DrawSpan.cc	Thu Jun 10 17:18:55 2010 +0900
@@ -224,7 +224,7 @@
     int alpha = color & 0xff000000;
 #endif
     /*完全に透けているか判断*/
-    int flag = (alpha != 0);
+    int flag = (alpha != 0 && normal_z < 0);
     int *light_sysswitch = (int*)smanager->global_get(LightSysSwitch);
     //smanager->printf("sys %d\n",light_sysswitch);
 
--- a/Renderer/Engine/task/DrawSpan.cc	Wed Jun 09 23:04:09 2010 +0900
+++ b/Renderer/Engine/task/DrawSpan.cc	Thu Jun 10 17:18:55 2010 +0900
@@ -57,13 +57,7 @@
 static float
 innerProduct1(float *v0, float *v1)
 {
-
-    if (v0[2] > 0) {
-      return 0;
-    } else {
       return (v0[0]*v1[0] + v0[1]*v1[1] + v0[2]*v1[2]);
-    }
-
 }
 
 
@@ -203,15 +197,18 @@
 
     int *light_sysswitch = (int*)smanager->global_get(LightSysSwitch);
 
-    /*完全に透けているか判断*/
-    int flag = (alpha != 0);
+
+    /*完全に透けているか判断, 法線ベクトルが奥を向いてるかどうか*/
+    int flag = (alpha != 0 && normal_z < 0);
 
     //printf("light_sysswitch %d\n",light_sysswitch);
 
     //if ( *light_sysswitch == 1) {
-      color = infinity_light_calc(color,normal_x,normal_y,normal_z,
-				  smanager,localx,localy,zpos,
-				  world_x,world_y,world_z);
+    if (flag) {
+           color = infinity_light_calc(color,normal_x,normal_y,normal_z,
+      				  smanager,localx,localy,zpos,
+      				  world_x,world_y,world_z);
+    }
       //}
 
     g->zRow[localx + (rangex*localy)] = zpos*flag + g->zRow[localx + (rangex*localy)]*(1-flag);
--- a/Renderer/Test/universe.cc	Wed Jun 09 23:04:09 2010 +0900
+++ b/Renderer/Test/universe.cc	Thu Jun 10 17:18:55 2010 +0900
@@ -47,6 +47,7 @@
     SceneGraphPtr moon;
 
     sgroot->createFromXMLfile( "xml_file/universe.xml");
+    sgroot->createFromXMLfile( "xml_file/cube.xml");
     sgroot->OnLightSysSwitch();
     SceneGraphPtr light = sgroot->getLight(0); 
     sgroot->OnLightSwitch(0);
--- a/TaskManager/kernel/ppe/TaskManagerImpl.cc	Wed Jun 09 23:04:09 2010 +0900
+++ b/TaskManager/kernel/ppe/TaskManagerImpl.cc	Thu Jun 10 17:18:55 2010 +0900
@@ -182,7 +182,7 @@
 void
 TaskManagerImpl::check_task_list_finish(SchedTask *s, TaskListPtr list, HTaskInfo *wait_queue)
 {
-    for(int i = 0;i<list->length;i++) {
+    for(int i = 0;i<list->length;i++) { 
 	SimpleTaskPtr task = &list->tasks[i];
 	HTask *me = (HTask*)task->self;
 	me->post_func(s, me->post_arg1, me->post_arg2);