changeset 688:91e6767f09d9

merge
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 07 Dec 2009 00:33:58 +0900
parents b386522827ae (current diff) e009805443ce (diff)
children f7ba14eed3c0
files
diffstat 6 files changed, 89 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Renderer/Engine/spe/DataLoad.cc	Mon Dec 07 00:33:58 2009 +0900
@@ -0,0 +1,25 @@
+#include <stdio.h>
+#include <string.h>
+#include "DataLoad.h"
+#include "Func.h"
+
+/* これは必須 */
+SchedDefineTask(DataLoad);
+
+static int
+run(SchedTask *s, void *rbuf, void *wbuf)
+{
+
+  int length = (int)s->get_param(0);
+  int load_id = (int)s->get_param(1);
+
+  //printf("size %d",sizeof(float)*length);
+
+  s->global_alloc(load_id, sizeof(float)*length);
+
+  //MemList *ml = s->createMemList(length,length);
+  //s->global_set(load_id, (void *)ml);
+
+  return 0;
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Renderer/Engine/spe/DataLoad.h	Mon Dec 07 00:33:58 2009 +0900
@@ -0,0 +1,9 @@
+#ifndef INCLUDED_TASK_LOAD
+#define INCLUDED_TASK_LOAD
+
+#ifndef INCLUDED_SCHED_TASK
+#  include "SchedTask.h"
+#endif
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Renderer/Engine/spe/DataUpdate.cc	Mon Dec 07 00:33:58 2009 +0900
@@ -0,0 +1,28 @@
+#include <stdio.h>
+#include "DataUpdate.h"
+#include "Func.h"
+
+/* これは必須 */
+SchedDefineTask(DataUpdate);
+
+static int
+run(SchedTask *s, void *rbuf, void *wbuf)
+{
+
+  float *idata = (float*)s->get_input(rbuf, 0);
+  int load_id = (int)s->get_param(0);
+  float *global_data = (float*)s->global_get(load_id);
+
+  global_data[0] = idata[0];
+  global_data[1] = idata[1];
+  global_data[2] = idata[2];
+  global_data[3] = idata[3];
+
+#if 0
+  s->printf("spe %f ",idata[0]);
+  s->printf("spe %f ",idata[1]);
+  s->printf("spe %f\n",idata[2]);
+#endif
+
+  return 0;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Renderer/Engine/spe/DataUpdate.h	Mon Dec 07 00:33:58 2009 +0900
@@ -0,0 +1,9 @@
+#ifndef INCLUDED_TASK_DATAUPDATE
+#define INCLUDED_TASK_DATAUPDATE
+
+#ifndef INCLUDED_SCHED_TASK
+#  include "SchedTask.h"
+#endif
+
+
+#endif
--- a/Renderer/Engine/spe/DrawSpan.cc	Mon Dec 07 00:32:34 2009 +0900
+++ b/Renderer/Engine/spe/DrawSpan.cc	Mon Dec 07 00:33:58 2009 +0900
@@ -39,8 +39,11 @@
 // static    TilePtr isAvailableTile(memaddr addr);
 static    memaddr getTile(int tx, int ty, int tw, memaddr tex_addr_top);
 static    int getTexBlock(int tx, int ty, int twidth);
-static    void updateBuffer(Gptr g, float zpos, int rangex, int x, int y,
-                      int tex_x, int tex_y, float normal_x, float nomral_x, float normal_z, TilePtr tile);
+
+static    void updateBuffer(Gptr g, float zpos, int rangex, int loaclx, int localy,
+                            int tex_x, int tex_y, float normal_x, float nomral_x, float normal_z,
+			    TilePtr tile, int world_x, int world_y, float world_z,SchedTask *smanager);
+
 
 
 // static    void reboot(SpanPackPtr spack, int cur_span_x);
@@ -180,7 +183,8 @@
  */
 static void
 updateBuffer(Gptr g, float zpos, int rangex, int x, int y, int tex_x, int tex_y,
-                       float normal_x, float normal_y, float normal_z, TilePtr tile)
+	     float normal_x, float normal_y, float normal_z, TilePtr tile,
+	     int world_x, int world_y, float world_z, SchedTask *smanager)
 {
 
     int color = get_rgb(tex_x, tex_y, tile);
@@ -258,7 +262,8 @@
 
         updateBuffer(g, zpos, rangex, localx, localy,
                      tex_localx, tex_localy,
-                     normal_x,normal_y,normal_z,tile);
+                     normal_x,normal_y,normal_z,tile,
+		     span->x, span->y, zpos, smanager);
     }
 
     return -1;
@@ -319,6 +324,10 @@
     float zpos1 = span->start_z;
     float zpos2 = span->end_z;
 
+    //spanを右から左に見ていくうちに、zが下がるのか、上がっていくのか。
+    float z_inclination = (zpos1 - zpos2) / x_len;
+    float world_z = zpos2;
+
     // Tile 内での座標
     int localx, localy = getLocalY(span->y-1);
 
@@ -328,6 +337,8 @@
     for (int j = je; j >= js; j--) {
         float tex_x, tex_y, tex_z;
 
+	world_z += z_inclination;
+
         localx = getLocalX(x-1+j);
 
         tex_z = zpos1*(x_len-1-j)/(x_len-1) + zpos2*j/(x_len-1);
@@ -357,7 +368,8 @@
 
             updateBuffer(g, tex_z, rangex, localx, localy,
                          tex_localx, tex_localy,
-                         normal_x, normal_y, normal_z, tile);
+                         normal_x, normal_y, normal_z, tile,
+			 span->x+j, span->y, world_z, smanager);
         }
     }
 
--- a/Renderer/Test/Makefile.cell	Mon Dec 07 00:32:34 2009 +0900
+++ b/Renderer/Test/Makefile.cell	Mon Dec 07 00:33:58 2009 +0900
@@ -20,7 +20,7 @@
 run: $(TARGET)
 	sudo ./$(TARGET) -width 576 -height 384 -bpp 32
 run-hd: $(TARGET)
-	sudo /usr/sbin/ps3-video-mode -v 133
+	sudo /usr/bin/ps3-video-mode -v 133
 	sudo ./$(TARGET) -video fb -width 1920 -height 1080 -bpp 32