Mercurial > hg > Members > kono > Cerium
diff TaskManager/Test/test_render/spe/DrawSpan.cpp @ 166:e297ecaf2b4d
fix
author | gongo@localhost.localdomain |
---|---|
date | Tue, 09 Dec 2008 11:53:51 +0900 |
parents | 246881f0634b |
children | c8b868871dce |
line wrap: on
line diff
--- a/TaskManager/Test/test_render/spe/DrawSpan.cpp Tue Dec 09 11:15:37 2008 +0900 +++ b/TaskManager/Test/test_render/spe/DrawSpan.cpp Tue Dec 09 11:53:51 2008 +0900 @@ -8,7 +8,6 @@ #define SPAN_PACK_LOAD 0 #define TEX_LOAD 1 -#define TILE_INFO_LOAD 2 SchedDefineTask(DrawSpan); @@ -157,13 +156,13 @@ char* -DrawSpan::get_pixel(int tx, int ty, void *texture_image) +DrawSpan::get_pixel(int tx, int ty, uint32 *texture_image) { - return (char*)texture_image+(4*((TEXTURE_SPLIT_PIXEL)*ty+tx)); + return (char*)(texture_image+((TEXTURE_SPLIT_PIXEL)*ty+tx)); } Uint32 -DrawSpan::get_rgb(int tx, int ty, void *addr) +DrawSpan::get_rgb(int tx, int ty, uint32 *addr) { Uint8 red, green, blue, alpha; TilePtr tile; @@ -265,10 +264,17 @@ float tey1 = span->tex_y1; float tey2 = span->tex_y2; + /** + * Span が持つ 1 pixel 毎の + * テクスチャの座標 + */ int tex_xpos; int tex_ypos; - int tex_zpos; + /** + * (tex_xpos, tex_ypos) の、ブロック内(上の図参照)での座標と + * そのブロックのアドレス(MainMemory) + */ int tex_localx; int tex_localy; uint32 *tex_addr; @@ -290,14 +296,13 @@ tex_xpos = (int)((span->tex_width-1) * tex1); tex_ypos = (int)((span->tex_height-1) * tey1); - tex_zpos = (int)z; if (zpos < zRow[localx + (rangex * localy)]) { + tex_addr = getTile(tex_xpos, tex_ypos, + span->tex_width, span->tex_addr); tex_localx = tex_xpos % TEXTURE_SPLIT_PIXEL; tex_localy = tex_ypos % TEXTURE_SPLIT_PIXEL; - tex_addr = getTile(tex_xpos, tex_ypos, - span->tex_width, span->tex_addr); - + rgb = get_rgb(tex_localx, tex_localy, tex_addr); zRow[localx + (rangex * localy)] = zpos; @@ -326,10 +331,10 @@ tex_ypos = (int)((span->tex_height-1) * tex_y); if (tex_z < zRow[localx + (rangex*localy)]) { + tex_addr = getTile(tex_xpos, tex_ypos, + span->tex_width, span->tex_addr); tex_localx = tex_xpos % TEXTURE_SPLIT_PIXEL; tex_localy = tex_ypos % TEXTURE_SPLIT_PIXEL; - tex_addr = getTile(tex_xpos, tex_ypos, - span->tex_width, span->tex_addr); rgb = get_rgb(tex_localx, tex_localy, tex_addr);