Mercurial > hg > Game > Cerium
diff Renderer/Test/send_linda.cc @ 841:8d702fc5d77a draft
dynamic loading demo bug fix
author | kazz <kazz@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Wed, 02 Jun 2010 01:39:15 +0900 |
parents | 91e2c96be77b |
children | de64695a7f02 |
line wrap: on
line diff
--- a/Renderer/Test/send_linda.cc Tue May 25 19:14:44 2010 +0900 +++ b/Renderer/Test/send_linda.cc Wed Jun 02 01:39:15 2010 +0900 @@ -23,26 +23,32 @@ send_position(SceneGraphPtr node) { char *data; - if ((data = (char *)psx_reply(node->seq)) == NULL) { - //float send_data[6]; // xyz[3] and angle[3] - int tapleid = node->id * 10 + 1; - int fd = *(int*)node->propertyptr; + if (node->seq == 0) { + } else if ((data = (char *)psx_reply(node->seq)) == NULL) { + psx_free(data); + } else { + node->resend_flag = 1; + return; + } + node->resend_flag = 0; + + //float send_data[6]; // xyz[3] and angle[3] + int tapleid = node->id * 10 + 1; + int fd = *(int*)node->propertyptr; - // XDRの準備 - XDR xdrs; - char send_data[SEND_DATA_SIZE]; - xdrmem_create(&xdrs, send_data, SEND_DATA_SIZE, XDR_ENCODE); + // XDRの準備 + XDR xdrs; + char send_data[SEND_DATA_SIZE]; + xdrmem_create(&xdrs, send_data, SEND_DATA_SIZE, XDR_ENCODE); - for (int i = 0; i < 3; i ++) { - xdr_float(&xdrs, &node->xyz[i]); - } - for (int i = 0; i < 3; i ++) { - xdr_float(&xdrs, &node->angle[i]); - } - node->seq = psx_in(fd, tapleid); - psx_out(fd, tapleid, (unsigned char *)send_data, SEND_DATA_SIZE); - psx_free(data); + for (int i = 0; i < 3; i ++) { + xdr_float(&xdrs, &node->xyz[i]); } + for (int i = 0; i < 3; i ++) { + xdr_float(&xdrs, &node->angle[i]); + } + node->seq = psx_in(fd, tapleid); + psx_out(fd, tapleid, (unsigned char *)send_data, SEND_DATA_SIZE); } void @@ -74,7 +80,7 @@ /* ここでキー入力を向こうに送る */ - if (flag) { + if (flag || node->resend_flag) { send_position(node); } } @@ -145,7 +151,7 @@ } static char *xml; -static const char *linda = HOSTNAME; +static char *linda = HOSTNAME; MainLoopPtr send_linda::init(Viewer *sgr, int screen_w, int screen_h) @@ -200,15 +206,12 @@ // 初期化のout() int pos_id = serial * 10 + 1; char pos_data[SEND_DATA_SIZE] = {0}; -// float pos_data[6]; -// for (int i = 0; i < 6; i++) { -// pos_data[i] = 0.0f; -// } + + // init seq + // send_position()でinの終了を確認する分岐が最初にあるため psx_out(tspace, pos_id, (unsigned char *)pos_data, SEND_DATA_SIZE); - - // 初期化のin() - // send_position()でinの終了を確認する分岐が最初にあるため - root->seq = psx_in(tspace, pos_id); + root->seq = 0; + root->resend_flag = 0; sgr->setSceneData(root); return sgr;