# HG changeset patch # User kazz # Date 1278427031 -32400 # Node ID f4bdf2b0d7da1602a7da2701a9a2490b54efac8d # Parent 596009c66065a08d139cecf0f9d78ec885172112 [Renderer/Test/aquarium] sync aquarium (1 bug) diff -r 596009c66065 -r f4bdf2b0d7da Renderer/Test/aquarium.cc --- a/Renderer/Test/aquarium.cc Tue Jul 06 19:25:52 2010 +0900 +++ b/Renderer/Test/aquarium.cc Tue Jul 06 23:37:11 2010 +0900 @@ -46,36 +46,35 @@ aquarium::set_position(SceneGraphPtr node, unsigned char *reply) { aqua::Position *pos = new aqua::Position(); pos->ParseFromArray(reply + LINDA_HEADER_SIZE, psx_get_datalength(reply)); - node->xyz[0] = pos->x(); + node->xyz[0] = pos->x() - start_x; node->xyz[1] = pos->y(); + printf("xyz: %f, %f\n", node->xyz[0], node->xyz[1]); + delete pos; } static void update_position_move(SceneGraphPtr node, void *sgroot_, int screen_w, int screen_h) { - //SceneGraphRoot *sgroot = (SceneGraphRoot *)sgroot_; + printf("move_xyz: %f, %f\n", node->xyz[0], node->xyz[1]); // LindaServerから座標データを取得してオブジェクトに反映させる。 if (!node->resend_flag || node->seq_rd != node->seq) { unsigned char *reply_rd = psx_reply(node->seq_rd); if (reply_rd != NULL) { aquarium::set_position(node, reply_rd); psx_free(reply_rd); - printf("rd get\n"); return; } } unsigned char *reply = psx_reply(node->seq); if (reply != NULL) { - aquarium::set_position(node, reply); +// aquarium::set_position(node, reply); psx_free(reply); node->seq = psx_wait_rd(aquarium::linda, node->id * 10 + 1); node->resend_flag = true; - printf("wait_rd get\n"); } else if (node->resend_flag) { node->seq_rd = psx_rd(aquarium::linda, node->id * 10 + 1); node->resend_flag = false; - printf("re rd get\n"); } } @@ -83,13 +82,13 @@ create_sg(Viewer *viewer, SceneGraphPtr parent, unsigned char *data, int len, int serial_id) { SceneGraphPtr child = viewer->sgroot->createSceneGraph(); - parent->addChild(child); viewer->sgroot->createFromXMLmemory(viewer->sgroot->tmanager, child, (char *)data, len); - child->set_move_collision(update_position_move, null_collision); // TODO: + child->set_move_collision(update_position_move, null_collision); child->id = serial_id; child->seq = psx_wait_rd(aquarium::linda, serial_id * 10 + 1); child->seq_rd = psx_rd(aquarium::linda, serial_id * 10 + 1); child->resend_flag = false; + parent->addChild(child); return child; } @@ -143,7 +142,7 @@ int pos_id = serial_id * 10 + 1; psx_callback_in(linda, pos_id, callback_free, NULL); aqua::Position *pos = new aqua::Position(); - pos->set_x(node->xyz[0]); + pos->set_x(node->xyz[0] + start_x); pos->set_y(node->xyz[1]); int size = pos->ByteSize(); unsigned char *msg = (unsigned char *) sgroot->manager->allocate(sizeof(char) * size); @@ -191,7 +190,7 @@ void *addr = file_map(xml_file_name, &size); SceneGraphPtr sgp = viewer->createSceneGraph(); viewer->createFromXMLmemory(sgp, (char *)addr, size); - sgp->set_move_collision(my_move, null_collision); // TODO: input from the controller + sgp->set_move_collision(my_move, null_collision); parent->addChild(sgp); @@ -200,7 +199,7 @@ int pos_id = serial_id * 10 + 1; aqua::Position *pos = new aqua::Position(); - pos->set_x(0.0f); + pos->set_x(0.0f + start_x); pos->set_y(0.0f); unsigned char *msg = (unsigned char *) viewer->manager->allocate(sizeof(unsigned char *) * size); pos->SerializeToArray(msg, size);