changeset 357:953811245b63

fix spe/DrawSpan.{cpp, h} spe/DrawSpanRenew.cpp
author root@henri.cr.ie.u-ryukyu.ac.jp
date Fri, 17 Jul 2009 17:13:17 +0900
parents b89ba1d96fff
children 73c53a067ffb
files TaskManager/Test/test_render/ball_bound.cpp TaskManager/Test/test_render/ieshoot.cpp TaskManager/Test/test_render/spe/DrawSpan.cpp TaskManager/Test/test_render/spe/DrawSpan.h TaskManager/Test/test_render/spe/DrawSpanRenew.cpp TaskManager/Test/test_render/task/DrawSpan.cpp
diffstat 6 files changed, 18 insertions(+), 33 deletions(-) [+]
line wrap: on
line diff
--- a/TaskManager/Test/test_render/ball_bound.cpp	Fri Jul 17 15:04:02 2009 +0900
+++ b/TaskManager/Test/test_render/ball_bound.cpp	Fri Jul 17 17:13:17 2009 +0900
@@ -19,7 +19,7 @@
 static float h0; // 初期高さ
 static float ball_radius = 100.0f;
 
-static int speed = 10.0f;
+static float speed = 10.0f;
 
 static void
 ball_move_idle2(SceneGraphPtr node, int screen_w, int screen_h)
--- a/TaskManager/Test/test_render/ieshoot.cpp	Fri Jul 17 15:04:02 2009 +0900
+++ b/TaskManager/Test/test_render/ieshoot.cpp	Fri Jul 17 17:13:17 2009 +0900
@@ -75,8 +75,8 @@
      * TODO
      *  Boss が複数居た場合、これじゃ駄目
      */
-    static int x_speed = 5.0f;
-    static int z_speed = 5.0f;
+    static float x_speed = 5.0f;
+    static float z_speed = 5.0f;
 
     node->xyz[0] += x_speed;
 
--- a/TaskManager/Test/test_render/spe/DrawSpan.cpp	Fri Jul 17 15:04:02 2009 +0900
+++ b/TaskManager/Test/test_render/spe/DrawSpan.cpp	Fri Jul 17 17:13:17 2009 +0900
@@ -177,7 +177,7 @@
     TilePtr tile;
 
     tile = tileList->nextTile();
-    uint32 old_addr = tile->texture_addr;
+    uint32 *old_addr = tile->texture_addr;
     smanager->dma_load(tile->pixel, (uint32)addr,
                        sizeof(uint32)*TEXTURE_BLOCK_SIZE, tag);
     /**
@@ -450,10 +450,6 @@
         &DrawSpan::drawDot1, &DrawSpan::drawLine1
     };
 
-    void (DrawSpan::*drawFunc2[2])(SpanPtr, int, int, int, int) = {
-        &DrawSpan::drawDot2, &DrawSpan::drawLine2
-    };
-
     uint32 display   = smanager->get_param(0);
     int screen_width = smanager->get_param(1);
     int rangex_start = smanager->get_param(2);
@@ -508,10 +504,6 @@
                     span, rangex_start, rangex_end, tl_tag[tl_tag_flg1]);
             next_span = span;
 
-            (this->*drawFunc2[(resume_span->length_x != 1)])(
-                resume_span, rangex_start, rangex_end, resume_span_x,
-                tl_tag[tl_tag_flg2]);
-
             resume_span = next_span;
             resume_span_x = next_span_x;
 
--- a/TaskManager/Test/test_render/spe/DrawSpan.h	Fri Jul 17 15:04:02 2009 +0900
+++ b/TaskManager/Test/test_render/spe/DrawSpan.h	Fri Jul 17 17:13:17 2009 +0900
@@ -33,16 +33,15 @@
 
     int* linebuf_init(int width, int height, int rgb);
     float* zRow_init(int width, int height);
-    void set_rgb(uint32 *addr, int wait_tag);
-    void set_rgbs(uint32 *addr, uint32 *max_addr, int wait_tag);
-    uint32 get_rgb(int tx, int ty, uint32 *addr);
+    TilePtr set_rgb(uint32 *addr, int wait_tag);
+    uint32 get_rgb(int tx, int ty, TilePtr tile);
     TilePtr isAvailableTile(uint32 *addr);
     uint32* getTile(int tx, int ty, int tw, uint32 *tex_addr_top);
     int getTexBlock(int tx, int ty, int twidth);
     void writebuffer(unsigned int display, int width, int height,
 		     int screen_width);
     void updateBuffer(float zpos, int rangex, int x, int y,
-		      int tex_x, int tex_y, uint32 *tex_addr);
+		      int tex_x, int tex_y, TilePtr tile);
 
 
     void reboot(SpanPackPtr spack, int cur_span_x);
--- a/TaskManager/Test/test_render/spe/DrawSpanRenew.cpp	Fri Jul 17 15:04:02 2009 +0900
+++ b/TaskManager/Test/test_render/spe/DrawSpanRenew.cpp	Fri Jul 17 17:13:17 2009 +0900
@@ -143,12 +143,13 @@
                     tex_localx = tex_xpos % TEXTURE_SPLIT_PIXEL;
                     tex_localy = tex_ypos % TEXTURE_SPLIT_PIXEL;
 
-                    if (!isAvailableTile(tex_addr)) {
-                        set_rgb(tex_addr, 0);
+		    TilePtr tile;
+                    if (!(tile = isAvailableTile(tex_addr))) {
+			tile = set_rgb(tex_addr, 0);
                         smanager->dma_wait(0);
                     }
 
-                    rgb = get_rgb(tex_localx, tex_localy, tex_addr);
+                    rgb = get_rgb(tex_localx, tex_localy, tile);
 
                     zRow[localx + (rangex*localy)] = zpos;
                     linebuf[localx + (rangex*localy)] = rgb;
@@ -186,21 +187,14 @@
                         tex_localx = tex_xpos % TEXTURE_SPLIT_PIXEL;
                         tex_localy = tex_ypos % TEXTURE_SPLIT_PIXEL;
 
-                        if (!isAvailableTile(tex_addr)) {
+			TilePtr tile;
+                        if (!(tile = isAvailableTile(tex_addr))) {
                             spack->info.start = t;
-#if 0
-                            set_rgbs(tex_addr,
-                                     getTile(span->tex_width-1, tex_ypos,
-                                             span->tex_width, span->tex_addr));
-                            reboot(spack, j);
-                            goto FINISH;
-#else
-                            set_rgb(tex_addr, TEX_LOAD);
+                            tile = set_rgb(tex_addr, TEX_LOAD);
                             smanager->dma_wait(TEX_LOAD);
-#endif
                         }
 
-                        rgb = get_rgb(tex_localx, tex_localy, tex_addr);
+                        rgb = get_rgb(tex_localx, tex_localy, tile);
 
                         zRow[localx + (rangex*localy)] = tex_z;
                         linebuf[localx + (rangex*localy)] = rgb;
--- a/TaskManager/Test/test_render/task/DrawSpan.cpp	Fri Jul 17 15:04:02 2009 +0900
+++ b/TaskManager/Test/test_render/task/DrawSpan.cpp	Fri Jul 17 17:13:17 2009 +0900
@@ -573,9 +573,9 @@
     flag = (inner_product > 0);
 
     // 内積を rgb にかけていく
-    rgb[0] = rgb[0]*inner_product*flag;
-    rgb[1] = rgb[1]*inner_product*flag;
-    rgb[2] = rgb[2]*inner_product*flag;
+    rgb[0] = (unsigned char)(rgb[0]*inner_product*flag);
+    rgb[1] = (unsigned char)(rgb[1]*inner_product*flag);
+    rgb[2] = (unsigned char)(rgb[2]*inner_product*flag);
 
     //計算した rgb を light_rgb にまとめる。
     light_rgb = (rgb[0] << 24) + (rgb[1] << 16) + (rgb[2] << 8) + (rgb[3]);