Mercurial > hg > Members > kono > Cerium
diff TaskManager/Test/test_render/spe/DrawSpan.cpp @ 133:435e0d24db39
DrawSpan のテクスチャ座標を求める部分で、width と height が逆に使われてた。
add new xml file
author | gongo@charles.cr.ie.u-ryukyu.ac.jp |
---|---|
date | Thu, 27 Nov 2008 15:08:10 +0900 |
parents | 805d27efafd8 |
children | 3ecf43bd1a35 |
line wrap: on
line diff
--- a/TaskManager/Test/test_render/spe/DrawSpan.cpp Tue Nov 25 18:19:53 2008 +0900 +++ b/TaskManager/Test/test_render/spe/DrawSpan.cpp Thu Nov 27 15:08:10 2008 +0900 @@ -99,11 +99,7 @@ char* DrawSpan::get_pixel(int tx, int ty, void *texture_image) { -#if 0 - return (char*)texture_image+(3*((128)*ty+tx)); -#else - return (char*)texture_image+(4*((8)*ty+tx)); -#endif + return (char*)texture_image+(4*((TEXTURE_SPLIT_PIXEL)*ty+tx)); } Uint32 @@ -118,12 +114,12 @@ void *texture_addr; - int blockX = tx / 8; - int blockY = ty / 8; + int blockX = tx / TEXTURE_SPLIT_PIXEL; + int blockY = ty / TEXTURE_SPLIT_PIXEL; void** addrList = (void**)global_get(TEXTURE2_ID); TilePtr tile; - texture_addr = addrList[blockX + (tw/8)*blockY]; + texture_addr = addrList[blockX + (tw/TEXTURE_SPLIT_PIXEL)*blockY]; /** * get,put ϥ֥(HashȤ)äƥ뤫 @@ -158,7 +154,8 @@ smanager->dma_wait(TEX_LOAD); } - char *p = get_pixel(tx%8, ty%8, tile->pixel); + char *p = get_pixel(tx%TEXTURE_SPLIT_PIXEL, + ty%TEXTURE_SPLIT_PIXEL, tile->pixel); alpha = 255; red = (Uint8) p[0]; @@ -196,7 +193,7 @@ for (int i = 0; i < rangey; i++) { linebuf[i] = (int*)smanager->get_output(i); - linebuf_init(linebuf[i], rangex, 0); + linebuf_init(linebuf[i], rangex, 0xffffff); } bzero(hash_table, sizeof(TilePtr)*hashsize); @@ -217,7 +214,6 @@ for (int t = 0; t < sp->info.size; t++) { span = &sp->span[t]; - int end = span->length_x; Uint32 rgb = 0x00ff00; float tex1 = span->tex_x1; float tex2 = span->tex_x2; @@ -228,6 +224,7 @@ int tex_zpos; int x = span->x; int y = span->y; + int x_len = span->length_x; float z = span->start_z; float zpos = span->end_z; @@ -235,12 +232,12 @@ int localx = getLocalX(x-1); int localy = getLocalY(y-1); - if (end == 1) { + if (x_len == 1) { if (x < rangex_start || rangex_end < x) { continue; } - tex_xpos = (int)((span->tex_height-1) * tex1); - tex_ypos = (int)((span->tex_width-1) * tey1); + 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)]) { @@ -252,18 +249,19 @@ } else { float tex_x, tex_y, tex_z; int js = (x < rangex_start) ? rangex_start - x : 0; - int je = (x + end > rangex_end) ? rangex_end - x : end; + int je = (x + x_len > rangex_end) ? rangex_end - x : x_len; for (int j = js; j <= je; j++) { localx = getLocalX(x-1+j); - tex_x = tex1*(end-1-j)/(end-1) + tex2*j/(end-1); - tex_y = tey1*(end-1-j)/(end-1) + tey2*j/(end-1); - tex_z = z*(end-1-j)/(end-1) + zpos*j/(end-1); + tex_z = z*(x_len-1-j)/(x_len-1) + zpos*j/(x_len-1); + + 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_height-1) * tex_x); - tex_ypos = (int)((span->tex_width-1) * tex_y); + tex_xpos = (int)((span->tex_width-1) * tex_x); + tex_ypos = (int)((span->tex_height-1) * tex_y); if (tex_z < zRow[localx + (rangex*localy)]) { rgb = get_rgb(tex_xpos, tex_ypos, span->tex_width,