Mercurial > hg > Members > kono > Cerium
diff TaskManager/Test/simple_pack/task/create_span.cpp @ 84:c2e178b3415f
create SPUSPANLIST no use task/spu_span.cpp
author | chiaki |
---|---|
date | Tue, 26 Feb 2008 21:49:50 +0900 |
parents | 459f54b49648 |
children |
line wrap: on
line diff
--- a/TaskManager/Test/simple_pack/task/create_span.cpp Wed Feb 20 17:25:48 2008 +0900 +++ b/TaskManager/Test/simple_pack/task/create_span.cpp Tue Feb 26 21:49:50 2008 +0900 @@ -1,6 +1,6 @@ #include <iostream> #include "polygon_pack.h" -#include "span_pack.h" +#include "spu_span.h" using namespace std; @@ -26,7 +26,7 @@ return vMid1; } -void half_triangle(SPANPACKLIST *spl, long *tex_addr, long tex_width, long tex_height, VertexPack *vMin, VertexPack *vMid, VertexPack *vMid1) { +void half_triangle(SPUSPANLIST *ssl, long *tex_addr, long tex_width, long tex_height, VertexPack *vMin, VertexPack *vMid, VertexPack *vMid1) { //void half_triangle(SPANPACK *sp, long *tex_addr, long tex_width, long tex_height, VertexPack *vMin, VertexPack *vMid, VertexPack *vMid1) { float tmp_z,tmp_tex1, tmp_tex2 ,tmp_tey1,tmp_tey2; float tmp_xpos,tmp_end,tmp_zpos; @@ -93,59 +93,33 @@ //add(tex_addr,tex_width,tex_height,x,y,length,start_z,end_z,start_tex_x,end_tex_x,start_tex_y,end_tex_y); + //y += 540; // window_height = 1080 (1080/2 = 540) + y += 240; // window_height = 480 (480/2 = 240) - y += 240; - int spu_no = y/8; - y -= 240; - - //int spu_no = 0; - int c = spl->dline[spu_no].info.size; - /* - if(c > 100) - { - cout << "over c = " << c << endl; - c = 0; - spl->dline[spu_no].info.size = 0; - } - */ + int line_set = y/8; + + //y -= 540; // window_height = 1080 (1080/2 = 540) + y -= 240; // window_height = 480 (480/2 = 240) + + int spu_no = line_set%6; + + int spp_no = line_set/6; + int span_no = ssl->ss[spu_no].spp[spp_no].info.size; - spl->dline[spu_no].span[c].tex_addr = tex_addr; - spl->dline[spu_no].span[c].tex_width = tex_width; - spl->dline[spu_no].span[c].tex_height = tex_height; - spl->dline[spu_no].span[c].x = x; - spl->dline[spu_no].span[c].y = y; - spl->dline[spu_no].span[c].length_x = length; - spl->dline[spu_no].span[c].start_z = start_z; - spl->dline[spu_no].span[c].end_z = end_z; - spl->dline[spu_no].span[c].tex_x1 = start_tex_x; - spl->dline[spu_no].span[c].tex_x2 = end_tex_x; - spl->dline[spu_no].span[c].tex_y1 = start_tex_y; - spl->dline[spu_no].span[c].tex_y2 = end_tex_y; - //if(c < 8) - { - spl->dline[spu_no].info.size++; - } - //cout << "spu_no : " << spu_no << endl; - //cout << "size : " <<spl->dline[spu_no].info.size << endl; - //cout << endl; - /* - int c = sp->info.size; - sp->span[c].tex_addr = tex_addr; - sp->span[c].tex_width = tex_width; - sp->span[c].tex_height = tex_height; - sp->span[c].x = x; - sp->span[c].y = y; - sp->span[c].length_x = length; - sp->span[c].start_z = start_z; - sp->span[c].end_z = end_z; - sp->span[c].tex_x1 = start_tex_x; - sp->span[c].tex_x2 = end_tex_x; - sp->span[c].tex_y1 = start_tex_y; - sp->span[c].tex_y2 = end_tex_y; - sp->info.size++; - //cout << sp->info.size << endl; - //cout << sp->span[0].x << endl; - */ + ssl->ss[spu_no].spp[spp_no].span[span_no].tex_addr = tex_addr; + ssl->ss[spu_no].spp[spp_no].span[span_no].tex_width = tex_width; + ssl->ss[spu_no].spp[spp_no].span[span_no].tex_height = tex_height; + ssl->ss[spu_no].spp[spp_no].span[span_no].x = x; + ssl->ss[spu_no].spp[spp_no].span[span_no].y = y; + ssl->ss[spu_no].spp[spp_no].span[span_no].length_x = length; + ssl->ss[spu_no].spp[spp_no].span[span_no].start_z = start_z; + ssl->ss[spu_no].spp[spp_no].span[span_no].end_z = end_z; + ssl->ss[spu_no].spp[spp_no].span[span_no].tex_x1 = start_tex_x; + ssl->ss[spu_no].spp[spp_no].span[span_no].tex_x2 = end_tex_x; + ssl->ss[spu_no].spp[spp_no].span[span_no].tex_y1 = start_tex_y; + ssl->ss[spu_no].spp[spp_no].span[span_no].tex_y2 = end_tex_y; + + ssl->ss[spu_no].spp[spp_no].info.size++; } } @@ -155,7 +129,8 @@ PolygonPack *polygon = (PolygonPack*)rbuf; //SPANPACK *sp = (SPANPACK*)wbuf; //SPANPACKLIST *spl = (SPANPACKLIST*)wbuf; - SPANPACKLIST *spl = polygon->spl; + //SPANPACKLIST *spl = polygon->spl; + SPUSPANLIST *ssl = polygon->ssl; VertexPack *vMin, *vMid, *vMax, *vMid10; VertexPack ver; vMid10 = &ver; @@ -164,11 +139,14 @@ //cout << "create_span:spl->dline[0].span = " << spl->dline[0].span << endl; //for(int i=0; i<spl->size; i++) - for(int i=0; i<60; i++) + for(int i=0; i<6; i++) // 6 = number of SPU { - spl->dline[i].info.size = 0; - //cout << i << endl; - //cout << spl->dline[i].info.size << endl; + ssl->ss[i].length = 0; + //for(int t=0; t<10; t++) // window_height = 1080 ( 1080/8/6 = 22.5 ) + for(int t=0; t<10; t++) // window_height = 480 (480/8/6 = 10) + { + ssl->ss[i].spp[t].info.size = 0; + } } //sp->info.size = 0; @@ -214,8 +192,8 @@ vMid1(vMid10,vMin,vMid,vMax); - half_triangle(spl,polygon->tri[a].tex_addr,polygon->tri[a].tex_width,polygon->tri[a].tex_height,vMin,vMid,vMid10); - half_triangle(spl,polygon->tri[0].tex_addr,polygon->tri[0].tex_width,polygon->tri[0].tex_height,vMax,vMid,vMid10); + half_triangle(ssl,polygon->tri[a].tex_addr,polygon->tri[a].tex_width,polygon->tri[a].tex_height,vMin,vMid,vMid10); + half_triangle(ssl,polygon->tri[0].tex_addr,polygon->tri[0].tex_width,polygon->tri[0].tex_height,vMax,vMid,vMid10); //printf("x:%d y:%d end:%d z:%f zpos:%f\n",sp->span[0].x,sp->span[0].y,sp->span[0].length_x,sp->span[0].start_z , sp->span[0].end_z); } //printf("create_span x:%d y:%d end:%d z:%f zpos:%f\n",sp->span[0].x,sp->span[0].y,sp->span[0].length_x,sp->span[0].start_z , sp->span[0].end_z);