changeset 593:6f741ab60749

sending and moving of multi xml work (linda)
author kazz@kazzone.st.ie.u-ryukyu.ac.jp
date Tue, 03 Nov 2009 21:08:47 +0900
parents 56e63fc45105
children 20166ecb1a78
files Renderer/Engine/SceneGraph.h Renderer/Test/dynamic_create.cc Renderer/Test/send_linda.cc
diffstat 3 files changed, 15 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/Renderer/Engine/SceneGraph.h	Sun Nov 01 06:25:12 2009 +0900
+++ b/Renderer/Engine/SceneGraph.h	Tue Nov 03 21:08:47 2009 +0900
@@ -23,7 +23,10 @@
     float stack_xyz[3];
     float stack_angle[3];
     int id;
-
+	// Objectのシーケンス番号(Linda)
+	// とりあえず動かしたいので追加
+	int seq;
+	
     int property_size;
     void* propertyptr;
 
--- a/Renderer/Test/dynamic_create.cc	Sun Nov 01 06:25:12 2009 +0900
+++ b/Renderer/Test/dynamic_create.cc	Tue Nov 03 21:08:47 2009 +0900
@@ -83,23 +83,20 @@
 static void
 moon_move(SceneGraphPtr node, int screen_w, int screen_h)
 {
-    //node->angle[0] += 3.0f;
-    //node->xyz[1] += 1.0f;
-
 	// LindaServerから座標データを取得してオブジェクトに反映させる。
-	static int seq = 0;
+//	static int seq = 0;
 	unsigned char *reply;
 
-	if (seq == 0)
-		seq = psx_wait_rd(sgroot->tid, node->id * 10 + 1);
+//	if (seq == 0)
+//		seq = psx_wait_rd(sgroot->tid, node->id * 10 + 1);
 	
-	reply = psx_reply(seq);
+	reply = psx_reply(node->seq);
 	if (reply != NULL) {
 		float *data = (float *)(reply + LINDA_HEADER_SIZE);		
 		for (int i = 0; i < 3; i++) {
 			node->xyz[i] = ntohl(data[i]);
 		}
-		seq = psx_wait_rd(sgroot->tid, node->id * 10 + 1);
+		node->seq = psx_wait_rd(sgroot->tid, node->id * 10 + 1);
 	}
 }
 
@@ -119,6 +116,8 @@
     sgroot->createFromXMLmemory(sgroot->tmanager, child, (char *)data, len);
     child->set_move_collision(moon_move, moon_collision);
 	child->id = serial_id;
+	child->seq = psx_wait_rd(sgroot->tid, serial_id * 10 + 1);
+
     return child;
 }
 
@@ -131,7 +130,6 @@
     SceneGraphPtr sgp;
     // ここで create
     //	fwrite(xml_data, 1, 10, stdout);
-	printf((char *)xml_data);
     sgp = create_sg(carg->manager, carg->node, xml_data, xml_len, carg->sid);
     printf("%s size %d loaded\n", sgp->children->name, xml_len);
     client_list_update(carg->manager, carg->clist, carg->sid, sgp);
@@ -150,7 +148,6 @@
     data = taple+LINDA_HEADER_SIZE;
     // clientのSerialIDを取得
     serial_id = ntohl(*(int *)data);
-//    serial_id = *(int *)data;
 	printf("serial id = %d\n", serial_id);
     // タプルを解放
     //psx_del(carg->tid, SERIAL_REGIST_TUPLE_NO);
@@ -187,7 +184,7 @@
     psx_callback_in(carg->tid, carg->read_id, callbacker, carg);
 }
 
-MainLoopPtr 
+MainLoopPtr
 dynamic_create::init(Viewer *sgroot, int screen_w, int screen_h)
 {
     //SceneGraphPtr earth;
@@ -199,8 +196,8 @@
     SceneGraphPtr parent;
     parent = sgroot->createSceneGraph();
     parent->set_move_collision(earth_move, earth_collision);
-    parent->xyz[0] += 300;
-    parent->xyz[1] += 300;
+//    parent->xyz[0] += 300;
+//    parent->xyz[1] += 300;
     linda_init(sgroot->manager, clist,  parent);
     
     // SceneGraphRoot に、使用する SceneGraph を設定する
@@ -232,9 +229,7 @@
         }
     }
 
-
     return init(manager, argc, argv);
-
 }
 
 void
--- a/Renderer/Test/send_linda.cc	Sun Nov 01 06:25:12 2009 +0900
+++ b/Renderer/Test/send_linda.cc	Tue Nov 03 21:08:47 2009 +0900
@@ -128,7 +128,7 @@
 	} while (data == 0);
     serial = atoi(data + LINDA_HEADER_SIZE);
     psx_free(data);
-
+	printf("serial id = %d\n", serial);
     return serial;
 }