Mercurial > hg > Game > Cerium
view Renderer/Engine/Light.cc @ 1616:05d449e7b9f8 draft
remove set_NDRange
author | Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 14 May 2013 13:40:50 +0900 |
parents | 3361f2b7c63b |
children |
line wrap: on
line source
#include "Light.h" #include "Func.h" void Light::init() { int light_num = 4; int size = sizeof(float)*4*light_num; //xyz+alfa(4) * light_num(4) int light_size = size / sizeof(float); light_xyz = (float *)manager->allocate(size); for (int i = 0; i < light_size ; i++) { light_xyz[i] = 0.0f; } for(int i = 0;i<SPE_0+spe_num;) { // including CPU_PPE==0 HTaskPtr data_load = manager->create_task(DataAllocate); data_load->set_param(0,(memaddr)3); // num of allocate block data_load->set_param(1,(memaddr)(sizeof(float)*4*light_num)); // 1st allocate size data_load->set_param(2,(memaddr)LightData); // 1st id data_load->set_param(3,(memaddr)(light_num * sizeof(int))); // 2nd size data_load->set_param(4,(memaddr)LightSwitch); // 2nd id data_load->set_param(5,(memaddr)16); // 3rd size data_load->set_param(6,(memaddr)LightSysSwitch); // 3rd id data_load->set_cpu((CPU_TYPE)i); data_load->spawn(); if (i==0) i=SPE_0; else i++; } light_switch = (int*)manager->allocate(size); for (int i = 0; i < light_num; i++) { light_switch[i] = 0; } int light_sw_size = 16; // LightSysSwitch は 4byte. 残り 12byte は DMA転送の為のパディング light_sysswitch = (int*)manager->allocate(light_sw_size); for (unsigned int i = 0; i < light_sw_size / sizeof(int); i++) { light_sysswitch[i] = 0; } } bool Light::exec(HTaskPtr task_next) { light_xyz_stock = sgroot->getLightVector(); light_switch_stock = sgroot->getLightSwitch(); light_sysswitch_stock = sgroot->getLightSysSwitch(); return true; } HTaskPtr Light::update(HTaskPtr task_next) { //task_next = manager->create_task(Dummy); //task_next->set_post(post2runLoop, (void*)this); //Light info update int light_num = 4; int size = sizeof(float)*4*light_num; //xyz+alpha(4) * light_num(4) int light_size = size / sizeof(float); for (int i = 0; i < light_size; i++) { light_xyz[i] = light_xyz_stock[i]; } for (int i = 0; i < light_num; i++) { light_switch[i] = light_switch_stock[i]; } light_sysswitch[0] = light_sysswitch_stock; HTask *data_update_wait = manager->create_task(Dummy); for(int i = 0;i<SPE_0+spe_num;) { // including CPU_PPE==0 HTaskPtr data_update = manager->create_task(DataUpdate); data_update->set_param(0,3); data_update->set_param(1,LightData); // GlobalSet ID base data_update->set_inData(0,light_xyz,size); // Light data_update->set_inData(1,light_switch,light_num * sizeof(int)); // LightSwitch = Light+1 data_update->set_inData(2,light_sysswitch,16); // LightSysSwitch = Light+2 data_update->set_cpu((CPU_TYPE)i); data_update_wait->wait_for(data_update); data_update->spawn(); if (i==0) i=SPE_0; else i++; } return data_update_wait; }