diff Renderer/Test/send_linda.cc @ 586:7e33deb9d3f4 draft

dynamic not work
author kazz@kazz187.st.ie.u-ryukyu.ac.jp
date Wed, 28 Oct 2009 19:44:33 +0900
parents 5ecdc6b12fe8
children d267ca1a6fa0
line wrap: on
line diff
--- a/Renderer/Test/send_linda.cc	Mon Oct 26 09:03:14 2009 +0900
+++ b/Renderer/Test/send_linda.cc	Wed Oct 28 19:44:33 2009 +0900
@@ -22,24 +22,24 @@
     Pad *pad = sgroot->getController();
 
     if (pad->right.isHold() || pad->left.isHold()) {
-	if (pad->right.isHold()) {
-	    node->xyz[0] += 5.0f;
-	} else if (pad->left.isHold()) {
-	    node->xyz[0] -= 5.0f;
-	}
+		if (pad->right.isHold()) {
+			node->xyz[0] += 5.0f;
+		} else if (pad->left.isHold()) {
+			node->xyz[0] -= 5.0f;
+		}
     }
     
     if (pad->down.isHold() || pad->up.isHold() ) {
-	if (pad->down.isHold()) {
-	    node->xyz[1] += 5.0f;
-	} else if (pad->up.isHold()) {
-	    node->xyz[1] -= 5.0f;
-	}
+		if (pad->down.isHold()) {
+			node->xyz[1] += 5.0f;
+		} else if (pad->up.isHold()) {
+			node->xyz[1] -= 5.0f;
+		}
     }
 
     /*
       ここでキー入力を向こうに送る
-     */
+	*/
     
 }
 
@@ -65,18 +65,18 @@
     struct stat sb;
 
     if ((fd = open(filename, O_RDONLY)) == -1) {
-	fprintf(stderr, "Can't open %s\n", filename);
-	perror(NULL);
+		fprintf(stderr, "Can't open %s\n", filename);
+		perror(NULL);
     }
     if (fstat(fd, &sb) == -1) {
-	fprintf(stderr, "Can't fstat %s\n", filename);
-	perror(NULL);
+		fprintf(stderr, "Can't fstat %s\n", filename);
+		perror(NULL);
     }
     *size = sb.st_size;
     addr = mmap(NULL, *size, PROT_READ, MAP_PRIVATE, fd, 0);
     if (addr == MAP_FAILED) {
-	perror("mmap error\n");
-	exit(EXIT_FAILURE);
+		perror("mmap error\n");
+		exit(EXIT_FAILURE);
     }
     close(fd);
 
@@ -136,7 +136,7 @@
 static char *linda = HOSTNAME;
 
 MainLoopPtr 
-send_linda::init(Viewer *sgroot, int screen_w, int screen_h)
+send_linda::init(Viewer *sgr, int screen_w, int screen_h)
 {
     void *addr;
     int size;
@@ -146,19 +146,17 @@
 
     SceneGraphPtr sgp;
     SceneGraphPtr root;
-    root = sgroot->createSceneGraph();
+    root = sgr->createSceneGraph();
     root->set_move_collision(root_move, root_collision);
-
-    // createFromXMLfile で object name のリストを生成して返したい
-    sgroot->createFromXMLfile( xml);
-    // 今だけは決め打ち、本当はリストを回して object 数 create したい
-    sgp = sgroot->createSceneGraph("Ball");
+    
+    addr = file_map(xml, &size);
+	sgp = sgr->createSceneGraph();
+    sgroot->createFromXMLmemory(sgroot->tmanager, sgp, xml, size);
     sgp->set_move_collision(move, collision);
     
     root->addChild(sgp);
-    
-    addr = file_map(xml, &size);
-    tspace = open_linda_java(linda, PORT_NUM);    
+
+	tspace = open_linda_java(linda, PORT_NUM);    
     serial = get_serial_id(tspace);
     xml_id = serial * 10;
     send_xml(tspace, xml_id, addr, size);   	    
@@ -166,8 +164,8 @@
     int client_id = htonl(serial);
     send_xml(tspace, LISTEN_PORT, (void *)client_id, sizeof(int));
 
-    sgroot->setSceneData(root);
-    return sgroot;
+    sgr->setSceneData(root);
+    return sgr;
 }
 
 extern Application *