diff TaskManager/Test/test_render/spe/DrawSpan.cpp @ 161:18c42658e0e7 draft fullHD_omedetou

texture の座標がマイナスになったあと、それを 0 にし忘れてた
author gongo@localhost.localdomain
date Mon, 08 Dec 2008 16:37:02 +0900
parents 16c3cbbbfc50
children dc7d10ae7460
line wrap: on
line diff
--- a/TaskManager/Test/test_render/spe/DrawSpan.cpp	Mon Dec 08 10:56:58 2008 +0900
+++ b/TaskManager/Test/test_render/spe/DrawSpan.cpp	Mon Dec 08 16:37:02 2008 +0900
@@ -14,7 +14,7 @@
 
 static const int hashsize = 263;
 
-static TilePtr hash_table[hashsize] = {NULL};
+static TilePtr hash_table[hashsize] = {0};
 
 unsigned short PRIME[8] = {
     0x002, 0x065, 0x0c7, 0x133, 0x191, 0x1f3, 0x259, 0x2bd,
@@ -123,7 +123,7 @@
 	tile->texture_addr = addr;
 
 	smanager->dma_load(tile->pixel, (uint32)addr,
-			   sizeof(uint32)*64, TEX_LOAD);
+			   sizeof(uint32)*TEXTURE_BLOCK_SIZE, TEX_LOAD);
 
 	int index = put(tile->texture_addr, tile);
 
@@ -167,15 +167,11 @@
 	(TileInfoListPtr)smanager->allocate(sizeof(TileInfoList));
     TileInfoListPtr next_tilist =
 	(TileInfoListPtr)smanager->allocate(sizeof(TileInfoList));
-    TileInfoPtr tinfo;
-
 
     tileList = (TileListPtr)smanager->allocate(sizeof(TileList));
     tileList->init();
 
-    int render_y = sp->info.y_top;
-    void *texture_image = global_get(TEXTURE_ID);
-
+    void *texture_image = global_get(TEXTURE_ID);    
     int rangex_start  = get_param(0); // Υô x ϰϤλ
     int rangex_end    = get_param(1); //  (start <= x <= end)
     int rangey        = get_param(2); // y ϰ (render_y + rangey - 1)
@@ -212,10 +208,6 @@
 			       sizeof(TileInfoList), TILE_INFO_LOAD);
 
 	    Uint32 rgb = 0x00ff00;
-	    float tex1 = span->tex_x1;
-	    float tex2 = span->tex_x2;
-	    float tey1 = span->tex_y1;
-	    float tey2 = span->tex_y2;
 	    int tex_xpos;
 	    int tex_ypos;
 	    int tex_zpos;
@@ -236,15 +228,10 @@
 		    continue;
 		}
 
-#if 1
 		tex_xpos = tilist->tileinfo[0].tix;
 		tex_ypos = tilist->tileinfo[0].tiy;
+		tex_zpos = (int)z;
 		texture_image = tilist->tileinfo[0].tile;
-#else
-		tex_xpos = (int)((span->tex_width-1) * tex1);
-		tex_ypos = (int)((span->tex_height-1) * tey1);
-		tex_zpos = (int)z;
-#endif					
 
 		if (zpos < zRow[localx + (rangex * localy)]) {
 		    rgb = get_rgb(tex_xpos, tex_ypos, texture_image);
@@ -301,25 +288,16 @@
 			len = max_x - cur_x;
 		    }
 
-		    float tex_x, tex_y, tex_z;
-
 		    for (int j = cur_x; j <= cur_x + len; j++) {
 			TileInfoPtr tinfo = &tilist->tileinfo[j%MAX_TILE_LIST];
+			float tex_z
+			     = z*(x_len-1-j)/(x_len-1) + zpos*j/(x_len-1);
+
 			localx = getLocalX(x-1+j);
-			tex_z = z*(x_len-1-j)/(x_len-1) + zpos*j/(x_len-1);
 
-#if 1
 			tex_xpos = tinfo->tix;
 			tex_ypos = tinfo->tiy;
 			texture_image = tinfo->tile;
-#else
-			tex_x = tex1*(x_len-1-j)/(x_len-1) + tex2*j/(x_len-1);
-			tex_y = tey1*(x_len-1-j)/(x_len-1) + tey2*j/(x_len-1);
-			if (tex_x > 1) tex_x = 1;
-			if (tex_y > 1) tex_y = 1;
-			tex_xpos = (int)((span->tex_width-1) * tex_x);
-			tex_ypos = (int)((span->tex_height-1) * tex_y);
-#endif
 
 			if (tex_z < zRow[localx + (rangex*localy)]) {
 			    rgb = get_rgb(tex_xpos, tex_ypos, texture_image);