diff Renderer/Engine/viewer.cc @ 761:c0a8af52fa43 draft

add lights
author yutaka@henri.cr.ie.u-ryukyu.ac.jp
date Sat, 06 Feb 2010 03:02:48 +0900
parents 45f7ab7101ea
children 4d83a6a958fd
line wrap: on
line diff
--- a/Renderer/Engine/viewer.cc	Thu Feb 04 14:50:01 2010 +0900
+++ b/Renderer/Engine/viewer.cc	Sat Feb 06 03:02:48 2010 +0900
@@ -105,14 +105,17 @@
     sgroot = new SceneGraphRoot(this->width, this->height);
     sgroot->tmanager = manager;
     
-    int size = sizeof(float)*4;
+    int size = sizeof(float)*4*4; //xyz+alfa(4) * light_num(4)
+    int light_size = size / sizeof(float);
 
     light_xyz_stock = (float *)manager->allocate(size);
     light_xyz = (float *)manager->allocate(size);
-    light_xyz[0] = 0.0f;
-    light_xyz[1] = 0.0f;
-    light_xyz[2] = 0.0f;
-    light_xyz[3] = 0.0f;
+
+    for (int i = 0; i < light_size ; i++) {
+      
+      light_xyz[i] = 0.0f;
+
+    }
 
     HTaskPtr data_load;
     data_load = manager->create_task(DataLoad);
@@ -130,7 +133,6 @@
     }
 
     MainLoop *mainloop = app->init(this, this->width, this->height);
-
     mainloop->mainLoop();
 }
 
@@ -470,16 +472,18 @@
     //task_next = manager->create_task(Dummy);
     //task_next->set_post(post2runLoop, (void*)this);
 
-    //Light info update
+   //Light info update
                                                                    
     HTaskPtr data_update;
     HTaskPtr data_update_wait;
-    int size = sizeof(float)*4;
+    int size = sizeof(float)*4*4; //xyz+alfa(4) * light_num(4) 
+    int light_size = size / sizeof(float);
 
-    light_xyz[0] = light_xyz_stock[0]; 
-    light_xyz[1] = light_xyz_stock[1]; 
-    light_xyz[2] = light_xyz_stock[2]; 
-    light_xyz[3] = light_xyz_stock[3]; 
+    for (int i = 0; i < light_size; i++) {
+
+      light_xyz[i] = light_xyz_stock[i]; 
+
+    }
     
     data_update_wait = manager->create_task(DataUpdate);
     data_update_wait->add_inData(light_xyz,size);