# HG changeset patch # User yutaka@henri.cr.ie.u-ryukyu.ac.jp # Date 1260097487 -32400 # Node ID e009805443ce3c4993e553b6aeb044214c4a9f11 # Parent 72d8bd31fc8c8035a1ccd6d491f0d981074e7848 span xyz diff -r 72d8bd31fc8c -r e009805443ce Renderer/Engine/spe/DrawSpan.cc --- a/Renderer/Engine/spe/DrawSpan.cc Sun Dec 06 17:37:20 2009 +0900 +++ b/Renderer/Engine/spe/DrawSpan.cc Sun Dec 06 20:04:47 2009 +0900 @@ -39,8 +39,11 @@ // static TilePtr isAvailableTile(memaddr addr); static memaddr getTile(int tx, int ty, int tw, memaddr tex_addr_top); static int getTexBlock(int tx, int ty, int twidth); -static void updateBuffer(Gptr g, float zpos, int rangex, int x, int y, - int tex_x, int tex_y, float normal_x, float nomral_x, float normal_z, TilePtr tile); + +static void updateBuffer(Gptr g, float zpos, int rangex, int loaclx, int localy, + int tex_x, int tex_y, float normal_x, float nomral_x, float normal_z, + TilePtr tile, int world_x, int world_y, float world_z,SchedTask *smanager); + // static void reboot(SpanPackPtr spack, int cur_span_x); @@ -180,7 +183,8 @@ */ static void updateBuffer(Gptr g, float zpos, int rangex, int x, int y, int tex_x, int tex_y, - float normal_x, float normal_y, float normal_z, TilePtr tile) + float normal_x, float normal_y, float normal_z, TilePtr tile, + int world_x, int world_y, float world_z, SchedTask *smanager) { int color = get_rgb(tex_x, tex_y, tile); @@ -258,7 +262,8 @@ updateBuffer(g, zpos, rangex, localx, localy, tex_localx, tex_localy, - normal_x,normal_y,normal_z,tile); + normal_x,normal_y,normal_z,tile, + span->x, span->y, zpos, smanager); } return -1; @@ -319,6 +324,10 @@ float zpos1 = span->start_z; float zpos2 = span->end_z; + //spanを右から左に見ていくうちに、zが下がるのか、上がっていくのか。 + float z_inclination = (zpos1 - zpos2) / x_len; + float world_z = zpos2; + // Tile 内での座標 int localx, localy = getLocalY(span->y-1); @@ -328,6 +337,8 @@ for (int j = je; j >= js; j--) { float tex_x, tex_y, tex_z; + world_z += z_inclination; + localx = getLocalX(x-1+j); tex_z = zpos1*(x_len-1-j)/(x_len-1) + zpos2*j/(x_len-1); @@ -357,7 +368,8 @@ updateBuffer(g, tex_z, rangex, localx, localy, tex_localx, tex_localy, - normal_x, normal_y, normal_z, tile); + normal_x, normal_y, normal_z, tile, + span->x+j, span->y, world_z, smanager); } }