changeset 1122:ec6b55aed337 draft

CreateSpan ver 1118. (can work Mac)
author tkaito
date Tue, 01 Feb 2011 15:50:10 +0900
parents d6725e0a7b3e
children 2a63ba2c9506
files Renderer/Engine/SceneGraphRoot.cc Renderer/Engine/spe/CreateSpan.cc Renderer/Engine/viewer.cc Renderer/Test/universe.cc Renderer/Test/untitled.cc
diffstat 5 files changed, 46 insertions(+), 98 deletions(-) [+]
line wrap: on
line diff
--- a/Renderer/Engine/SceneGraphRoot.cc	Fri Jan 28 23:04:59 2011 +0900
+++ b/Renderer/Engine/SceneGraphRoot.cc	Tue Feb 01 15:50:10 2011 +0900
@@ -252,15 +252,7 @@
 int
 SceneGraphRoot::getSgid(const char *name)
 {
-  /*
-    for(int i =0;i<= sg_src_id; i++) {
-	if (sg_src[i] && strcmp(name,sg_src[i]->name) == 0)
-	    return i;
-    }
-    return -1;
-  */
-  return sgid_hash.get_sgid(name);
-    
+  return sgid_hash.get_sgid(name);    
 }
 
 int
--- a/Renderer/Engine/spe/CreateSpan.cc	Fri Jan 28 23:04:59 2011 +0900
+++ b/Renderer/Engine/spe/CreateSpan.cc	Tue Feb 01 15:50:10 2011 +0900
@@ -290,14 +290,9 @@
 		smanager->dma_load(g->spack, (memaddr)spackList[index],
 				   sizeof(SpanPack), SPAN_PACK_LOAD);
 		g->prev_index = index;
+		smanager->dma_wait(SPAN_PACK_LOAD);
 	    }
-	    
-	    tmp_xpos = calc(vMid10->x - vMin->x ,div_y, i, vMin->x);
-	    tmp_end  = calc(vMid->x  - vMin->x ,div_y, i, vMin->x);
-	    tmp_z    = calc(vMid10->z - vMin->z ,div_y, i, vMin->z);
-	    tmp_zpos = calc(vMid->z  - vMin->z ,div_y, i, vMin->z);
 
-	    smanager->dma_wait(SPAN_PACK_LOAD);
 	    
 	    /**
 	     * 書き込む SpanPack が満杯だったら
@@ -327,39 +322,6 @@
 		
 		smanager->dma_load(g->spack, (memaddr)spackList[index],
 				   sizeof(SpanPack), SPAN_PACK_LOAD);
-	    }
-
-	    tmp_tex1 =((i/(div_y)) * vMid10->tex_x) +
-	      ( ((div_y - i)/(div_y)) * vMin->tex_x);
-	    tmp_tex2 =( (i/(div_y)) * vMid->tex_x) +
-	      ( ((div_y - i)/(div_y)) * vMin->tex_x);
-	    
-	    tmp_tey1 =( (i/(div_y)) * vMid10->tex_y) +
-	      ( ((div_y - i)/(div_y)) * vMin->tex_y);
-	    tmp_tey2 =( (i/(div_y)) * vMid->tex_y) +
-	      ( ((div_y - i)/(div_y)) * vMin->tex_y);
-	    
-	    if (tmp_xpos > tmp_end) {
-	      x = (int)tmp_end;
-	      length = (int)(tmp_xpos)-(int)(tmp_end)+1;
-	      start_z = tmp_zpos;
-	      end_z = tmp_z;
-	      start_tex_x = tmp_tex2;
-	      end_tex_x = tmp_tex1;
-	      start_tex_y = tmp_tey2;
-	      end_tex_y = tmp_tey1;
-	    } else {
-	      x = (int)tmp_xpos;
-	      length = (int)(tmp_end)-(int)(tmp_xpos)+1;
-	      start_z = tmp_z;
-	      end_z = tmp_zpos;
-	      start_tex_x = tmp_tex1;
-	      end_tex_x = tmp_tex2;
-	      start_tex_y = tmp_tey1;
-	      end_tex_y = tmp_tey2;
-	    }
-
-	    if (g->send_spack->info.size >= MAX_SIZE_SPAN) {    
 		smanager->dma_wait(SPAN_PACK_LOAD);
 		g->spack->init((index+1)*split_screen_h);
 	    }
@@ -370,6 +332,41 @@
 	     */
 	    continue;
 	}
+
+	tmp_xpos = calc(vMid10->x - vMin->x ,div_y, i, vMin->x);
+	tmp_end  = calc(vMid->x  - vMin->x ,div_y, i, vMin->x);
+	tmp_z    = calc(vMid10->z - vMin->z ,div_y, i, vMin->z);
+	tmp_zpos = calc(vMid->z  - vMin->z ,div_y, i, vMin->z);
+
+	tmp_tex1 =((i/(div_y)) * vMid10->tex_x) +
+	  ( ((div_y - i)/(div_y)) * vMin->tex_x);
+	tmp_tex2 =( (i/(div_y)) * vMid->tex_x) +
+	  ( ((div_y - i)/(div_y)) * vMin->tex_x);
+	
+	tmp_tey1 =( (i/(div_y)) * vMid10->tex_y) +
+	  ( ((div_y - i)/(div_y)) * vMin->tex_y);
+	tmp_tey2 =( (i/(div_y)) * vMid->tex_y) +
+	  ( ((div_y - i)/(div_y)) * vMin->tex_y);
+	
+	if (tmp_xpos > tmp_end) {
+	  x = (int)tmp_end;
+	  length = (int)(tmp_xpos)-(int)(tmp_end)+1;
+	  start_z = tmp_zpos;
+	  end_z = tmp_z;
+	  start_tex_x = tmp_tex2;
+	  end_tex_x = tmp_tex1;
+	  start_tex_y = tmp_tey2;
+	  end_tex_y = tmp_tey1;
+	} else {
+	  x = (int)tmp_xpos;
+	  length = (int)(tmp_end)-(int)(tmp_xpos)+1;
+	  start_z = tmp_z;
+	  end_z = tmp_zpos;
+	  start_tex_x = tmp_tex1;
+	  end_tex_x = tmp_tex2;
+	  start_tex_y = tmp_tey1;
+	  end_tex_y = tmp_tey2;
+	}
 	
 	length = (tmp_xpos > tmp_end)
 	    ? (int)tmp_xpos - (int)tmp_end : (int)tmp_end - (int)tmp_xpos;
--- a/Renderer/Engine/viewer.cc	Fri Jan 28 23:04:59 2011 +0900
+++ b/Renderer/Engine/viewer.cc	Tue Feb 01 15:50:10 2011 +0900
@@ -381,7 +381,7 @@
   HTaskPtr task_next = smanager->create_task(RUN_LOOP_TASK, 0, 0, 0, 0); 
   task_next->set_param(0, (void*)viewer);
   viewer->run_draw(task_next);
-
+  
   return 0;
 
 }
--- a/Renderer/Test/universe.cc	Fri Jan 28 23:04:59 2011 +0900
+++ b/Renderer/Test/universe.cc	Tue Feb 01 15:50:10 2011 +0900
@@ -17,7 +17,7 @@
 static void
 moon_move(SceneGraphPtr node, void *sgroot_, int screen_w, int screen_h)
 {
-  //node->angle[0] += 3.0f;
+  node->angle[0] += 3.0f;
 }
 
 
@@ -50,17 +50,19 @@
     sgroot->createFromXMLfile( "xml_file/cube.xml");
     sgroot->OnLightSysSwitch();
     SceneGraphPtr light = sgroot->getLight(0); 
-    sgroot->OnLightSwitch(0);
+    sgroot->OnLightSwitch(1);
     light->xyz[2] -= 10;
 
-    // SGList.h にある SceneGraph ID から SceneGraph を生成する
+    // SceneGraph ID から SceneGraph を生成する
     earth = sgroot->createSceneGraph("Earth");
 
     // SceneGraph の move と collision を設定
     earth->set_move_collision(earth_move, earth_collision);
     earth->xyz[0] = screen_w / 2;
     earth->xyz[1] = screen_h / 2;
-    
+    earth->stack_xyz[0] = 3.0f;
+    earth->stack_xyz[1] = 3.0f;
+   
     moon = sgroot->createSceneGraph("Moon");
     moon->set_move_collision(moon_move, moon_collision);
     
@@ -69,7 +71,7 @@
     earth->addChild(moon);
 
     // SceneGraphRoot に、使用する SceneGraph を設定する
-    // このとき、ユーザーが記述した SceneGraph の root を渡す。
+    // このとき、ユーザーは SceneGraph の root を渡す。
     sgroot->setSceneData(earth);
     return sgroot;
 }
--- a/Renderer/Test/untitled.cc	Fri Jan 28 23:04:59 2011 +0900
+++ b/Renderer/Test/untitled.cc	Tue Feb 01 15:50:10 2011 +0900
@@ -21,29 +21,6 @@
 {
 
   node->angle[0] += 10.0f;
-  /*
-  node->stack_xyz[0] = 2.0f;
-  node->stack_xyz[1] = 2.0f;
-
-  //node->xyz[0] += node->stack_xyz[0];
-  node->xyz[0] += node->stack_xyz[0];
-  node->xyz[1] += node->stack_xyz[1];
-
-  if ((int)node->xyz[0] > screen_w 
-      || (int)node->xyz[0] < 0) {
-    node->stack_xyz[0] = -node->stack_xyz[0];
-  }
-  
-  if ((int)node->xyz[1] > screen_w 
-      || (int)node->xyz[1] < 0) {
-    node->stack_xyz[1] = -node->stack_xyz[1];
-  }  
-
-  if ((int)node->xyz[2] >  1000
-      || (int)node->xyz[2] < 100) {
-    node->stack_xyz[1] = -node->stack_xyz[1];
-  }  
-  */
   
 }
 
@@ -54,22 +31,17 @@
     if (node->angle[1] > 360.0f) {
 	node->angle[1] = 0.0f;
     }
-    //node->xyz[0] = screen_w/2;
     node->xyz[0] += node->stack_xyz[0];
     if ((int)node->xyz[0] > screen_w || (int)node->xyz[0] < 0) {
 	node->stack_xyz[0] = -node->stack_xyz[0];
     }
-    //node->xyz[1] = screen_h/2;
+
     node->xyz[1] += node->stack_xyz[1];
     if ((int)node->xyz[1] > screen_h || (int)node->xyz[1] < 0) {
 	node->stack_xyz[1] = -node->stack_xyz[1];
     }
 
     node->xyz[2] = 100 ;
-    //node->xyz[2] += node->stack_xyz[2];
-    //if ((int)node->xyz[2] > screen_h || (int)node->xyz[2] < 100) {
-    //node->stack_xyz[2] = -node->stack_xyz[2];
-    //}
   
 }
 
@@ -89,19 +61,6 @@
 
     sgroot->createFromXMLfile( "xml_file/Venus.xml");
 
-    // SGList.h にある SceneGraph ID から SceneGraph を生成する
-    /*
-    test00 = sgroot->createSceneGraph(cubetest000);
-    test01 = sgroot->createSceneGraph(cubetest009);
-    test02 = sgroot->createSceneGraph(cubetest008);
-    test03 = sgroot->createSceneGraph(cubetest007);
-    test04 = sgroot->createSceneGraph(cubetest006);
-    test05 = sgroot->createSceneGraph(cubetest005);
-    test06 = sgroot->createSceneGraph(cubetest004);
-    test07 = sgroot->createSceneGraph(cubetest003);
-    test08 = sgroot->createSceneGraph(cubetest002);
-    test09 = sgroot->createSceneGraph(cubetest001);
-    */
     test00 = sgroot->createSceneGraph("Venus000");
     test01 = sgroot->createSceneGraph("Venus009");
     test02 = sgroot->createSceneGraph("Venus008");
@@ -118,8 +77,6 @@
     test00->stack_xyz[0] = 3.0f;
     test00->stack_xyz[1] = 3.0f;
     test00->stack_xyz[2] = 3.0f;
-
-    
     
     test01->set_move_collision(test_move, test_collision);
     test02->set_move_collision(test_move, test_collision);