# HG changeset patch # User gongo@charles.cr.ie.u-ryukyu.ac.jp # Date 1227601458 -32400 # Node ID 215c22c07a4c2bb9b5b4517b3fb75ce1f2e9ac1d # Parent 40978d4b608a8febbfa076ba6aabcad7e2f92a0d fix diff -r 40978d4b608a -r 215c22c07a4c TaskManager/Test/test_render/Makefile.def --- a/TaskManager/Test/test_render/Makefile.def Tue Nov 25 17:19:43 2008 +0900 +++ b/TaskManager/Test/test_render/Makefile.def Tue Nov 25 17:24:18 2008 +0900 @@ -3,10 +3,10 @@ # include/library path # ex: macosx #CERIUM = /Users/gongo/Source/Concurrency/Game_project/Cerium -CERIUM = /Users/gongo/Source/hg/Cerium +#CERIUM = /Users/gongo/Source/hg/Cerium # ex: linux/ps3 -#CERIUM = /home/gongo/Cerium +CERIUM = /home/gongo/Cerium #CERIUM = ../../.. diff -r 40978d4b608a -r 215c22c07a4c TaskManager/Test/test_render/spe/DrawSpan.cpp --- a/TaskManager/Test/test_render/spe/DrawSpan.cpp Tue Nov 25 17:19:43 2008 +0900 +++ b/TaskManager/Test/test_render/spe/DrawSpan.cpp Tue Nov 25 17:24:18 2008 +0900 @@ -62,7 +62,8 @@ for (int i = 0; i < hashsize/2; i++) { int index = (hashval + i*i)%hashsize; - if (hash_table[index]->texture_addr == key) { + if (hash_table[index] != NULL && + hash_table[index]->texture_addr == key) { return hash_table[index]; } } @@ -106,14 +107,14 @@ } Uint32 -DrawSpan::get_rgb(int tx, int ty, void *texture) +DrawSpan::get_rgb(int tx, int ty, int tw, int th, void *texture) { Uint8 red, green, blue, alpha; if (tx<0) tx = 0; - if (tex_width-1< tx) tx = tex_width-1 ; + if (tw-1< tx) tx = tw-1 ; if (ty<0) ty = 0; - if (tex_height-1< ty) ty = tex_height-1 ; + if (th-1< ty) ty = th-1 ; void *texture_addr; @@ -122,8 +123,11 @@ void** addrList = (void**)global_get(TEXTURE2_ID); TilePtr tile; - texture_addr = addrList[blockX + (tex_width/8)*blockY]; + texture_addr = addrList[blockX + (tw/8)*blockY]; + /** + * get,put はオブジェクト(Hashとか?)を作ってアクセスするかな + */ tile = get(texture_addr); if (tile == NULL) { if (tileList->size >= MAX_TILE) { @@ -138,6 +142,12 @@ sizeof(uint32)*64, TEX_LOAD); int index = put(tile->texture_addr, tile); + + /** + * TODO: + * 入らなかったやつは + * 今までのやつを描画してから続きをするとか + */ if (index < 0) { printf("[%p] Can't entry\n", tile); return 0xff0000; @@ -148,7 +158,7 @@ smanager->dma_wait(TEX_LOAD); } - char *p = get_pixel(tx%8, ty%8, tile); + char *p = get_pixel(tx%8, ty%8, tile->pixel); alpha = 255; red = (Uint8) p[0]; @@ -224,18 +234,18 @@ // 座標が [0 .. split_screen_w-1] に入るように x,y を -1 int localx = getLocalX(x-1); int localy = getLocalY(y-1); - + if (end == 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_zpos = (int)z; if (zpos < zRow[localx + (rangex * localy)]) { - rgb = get_rgb(tex_xpos, tex_ypos, texture_image); + rgb = get_rgb(tex_xpos, tex_ypos, span->tex_width, + span->tex_height, texture_image); zRow[localx + (rangex * localy)] = zpos; linebuf[localy][localx] = rgb; } @@ -256,7 +266,8 @@ tex_ypos = (int)((span->tex_width-1) * tex_y); if (tex_z < zRow[localx + (rangex*localy)]) { - rgb = get_rgb(tex_xpos, tex_ypos, texture_image); + rgb = get_rgb(tex_xpos, tex_ypos, span->tex_width, + span->tex_height, texture_image); zRow[localx + (rangex*localy)] = tex_z; linebuf[localy][localx] = rgb; } diff -r 40978d4b608a -r 215c22c07a4c TaskManager/Test/test_render/spe/DrawSpan.h --- a/TaskManager/Test/test_render/spe/DrawSpan.h Tue Nov 25 17:19:43 2008 +0900 +++ b/TaskManager/Test/test_render/spe/DrawSpan.h Tue Nov 25 17:24:18 2008 +0900 @@ -41,7 +41,7 @@ void linebuf_init(int *buf, int width, int rgb); char* get_pixel(int tx, int ty, void *texture_image); - Uint32 get_rgb(int tx, int ty, void *texture); + Uint32 get_rgb(int tx, int ty, int tw, int th, void *texture); }; #endif