Mercurial > hg > Game > Cerium
diff TaskManager/Test/test_render/spe/DrawSpan.cpp @ 155:79ded2ad7236 draft
TextureInfoList がずれてたのを修正
author | gongo@gendarme.local |
---|---|
date | Thu, 04 Dec 2008 13:58:41 +0900 |
parents | 74341c8bf935 |
children | 16c3cbbbfc50 |
line wrap: on
line diff
--- a/TaskManager/Test/test_render/spe/DrawSpan.cpp Wed Dec 03 20:14:23 2008 +0900 +++ b/TaskManager/Test/test_render/spe/DrawSpan.cpp Thu Dec 04 13:58:41 2008 +0900 @@ -258,7 +258,7 @@ tex_ypos = (int)((span->tex_height-1) * tey1); tex_zpos = (int)z; -#if 0 +#if 1 if (tex_xpos != tilist->tileinfo[0].tix && tex_xpos != tilist->tileinfo[0].tix) { fprintf(stderr, "1: (%3d, %3d), (%3d, %3d)\n", @@ -280,18 +280,18 @@ } else { int js = (x < rangex_start) ? rangex_start - x : 0; int je = (x + x_len > rangex_end) ? rangex_end - x : x_len; - + if (js > je) continue; int cur_x = 0; int max_x = je; - int len; + int len = 0; /** * Span ɽʤϰ([js..je]) TileInfoList * äƤΤǡФ */ - while (cur_x + MAX_TILE_LIST < js) { + while (cur_x + MAX_TILE_LIST <= js) { smanager->dma_load(next_tilist, (uint32)tilist->next, sizeof(TileInfoList), TILE_INFO_LOAD); smanager->dma_wait(TILE_INFO_LOAD); @@ -306,17 +306,29 @@ cur_x = js; while (cur_x <= max_x) { - if (cur_x + MAX_TILE_LIST - 1 < max_x) { + /** + * TileInfoList 30 ĤǶڤƤΤ + * cur_x TileInfoList 椫ϤޤäƤ + * MAX_TILE_LIST ˼ޤͤ + * (ex.) + * cur_x (=js) 0 Ϥޤä硢 + * cur_x = 0, len = 29 + * cur_x (=js) 15 Ϥޤä硢 + * cur_x = 15, len = 14 ˤʤ + */ + int cur_x_diff = MAX_TILE_LIST - (cur_x % MAX_TILE_LIST); + + if (cur_x + cur_x_diff - 1 < max_x) { smanager->dma_load(next_tilist, (uint32)tilist->next, sizeof(TileInfoList), TILE_INFO_LOAD); - len = MAX_TILE_LIST - 1; + len = cur_x_diff - 1; } else { len = max_x - cur_x; } float tex_x, tex_y, tex_z; - + for (int j = cur_x; j <= cur_x + len; j++) { localx = getLocalX(x-1+j); tex_z = z*(x_len-1-j)/(x_len-1) + zpos*j/(x_len-1); @@ -328,7 +340,6 @@ tex_xpos = (int)((span->tex_width-1) * tex_x); tex_ypos = (int)((span->tex_height-1) * tex_y); -#if 0 if (tex_xpos != tilist->tileinfo[j%MAX_TILE_LIST].tix && tex_xpos != tilist->tileinfo[j%MAX_TILE_LIST].tix) { fprintf(stderr, "size = %d\n", tilist->size); @@ -339,7 +350,6 @@ tilist->tileinfo[j%MAX_TILE_LIST].tix, tilist->tileinfo[j%MAX_TILE_LIST].tiy); } -#endif tex_xpos = tilist->tileinfo[j%MAX_TILE_LIST].tix; tex_ypos = tilist->tileinfo[j%MAX_TILE_LIST].tiy; @@ -359,7 +369,7 @@ tilist = next_tilist; next_tilist = tmp; - cur_x += MAX_TILE_LIST; + cur_x += cur_x_diff; } } }