Mercurial > hg > Members > kono > Cerium
comparison TaskManager/Test/test_render/spe/ChainCal.cpp @ 396:d1f1e27d0a12
don't move. separate allExecute from run_loop
author | game@henri.cr.ie.u-ryukyu.ac.jp |
---|---|
date | Fri, 18 Sep 2009 18:28:56 +0900 |
parents | 8c5fa57128cb |
children | b24ea9ca59fd |
comparison
equal
deleted
inserted
replaced
395:8c5fa57128cb | 396:d1f1e27d0a12 |
---|---|
29 } CHAIN_VARS; | 29 } CHAIN_VARS; |
30 | 30 |
31 int | 31 int |
32 ChainCal::run(void *rbuf, void *wbuf) | 32 ChainCal::run(void *rbuf, void *wbuf) |
33 { | 33 { |
34 CHAIN_VARS* property = (CHAIN_VARS*)global_get(DATA_ID); | 34 CHAIN_VARS* property = (CHAIN_VARS*)rbuf; |
35 //&property[CHAIN_LEN-1] = (CHAIN_VARS*)get_input(rbuf, 0); | |
36 CHAIN_VARS* pro = (CHAIN_VARS*)get_input(rbuf, 0); | |
37 int id = get_param(0); | 35 int id = get_param(0); |
38 memcpy(&property[CHAIN_LEN-1], pro, sizeof(CHAIN_VARS)); | |
39 | 36 |
40 CHAIN_VARS* o_property = (CHAIN_VARS*)get_output(wbuf, 0); | 37 //CHAIN_VARS* o_property = (CHAIN_VARS*)wbuf; |
41 | 38 |
42 for(int cnt = 0; cnt < 600; cnt++) { | 39 for(int cnt = 0; cnt < 600; cnt++) { |
43 for(int i = 0; i < CHAIN_LEN; i++) { | 40 for(int i = 0; i < CHAIN_LEN; i++) { |
44 if(property[i].can_move) { | 41 if(property[i].can_move) { |
45 double dx = property[i-1].x - property[i].x; | 42 double dx = property[i-1].x - property[i].x; |
74 property[i].x = property[i].next_x; | 71 property[i].x = property[i].next_x; |
75 property[i].y = property[i].next_y; | 72 property[i].y = property[i].next_y; |
76 } | 73 } |
77 } | 74 } |
78 | 75 |
79 int p, n; | 76 for (int j = 0; j < CHAIN_LEN; j++) { |
80 p = n = id; | 77 int p, n; |
81 if(p != 0) { | 78 id = property[j].id; |
82 p--; | 79 p = n = id; |
80 if(p != 0) { | |
81 p--; | |
82 } | |
83 if(n != CHAIN_LEN - 1) { | |
84 n++; | |
85 } | |
86 property[j].angle[2-(id%2)*2] | |
87 = 90 + atan((property[p].next_y - property[n].next_y) / (property[p].next_x - property[n].next_x)) * 180 / M_PI; | |
83 } | 88 } |
84 if(n != CHAIN_LEN - 1) { | 89 |
85 n++; | |
86 } | |
87 property->angle[2-(id%2)*2] | |
88 = 90 + atan((property[p].next_y - property[n].next_y) / (property[p].next_x - property[n].next_x)) * 180 / M_PI; | |
89 | |
90 o_property = property; | |
91 | |
92 return 0; | 90 return 0; |
93 } | 91 } |