From: <ze...@us...> - 2009-07-19 08:23:17
|
Revision: 2622 http://desmume.svn.sourceforge.net/desmume/?rev=2622&view=rev Author: zeromus Date: 2009-07-19 08:23:14 +0000 (Sun, 19 Jul 2009) Log Message: ----------- gfx3d: i've realized that the poly sorting must happen after clipping. there is no way to do this now, so to approximate really well, it, we will perspective divide the y values. fixes island of happiness shop menus. Modified Paths: -------------- trunk/desmume/src/gfx3d.cpp Modified: trunk/desmume/src/gfx3d.cpp =================================================================== --- trunk/desmume/src/gfx3d.cpp 2009-07-19 07:07:58 UTC (rev 2621) +++ trunk/desmume/src/gfx3d.cpp 2009-07-19 08:23:14 UTC (rev 2622) @@ -2396,15 +2396,21 @@ //find the min and max y values for each poly. //TODO - this could be a small waste of time if we are manual sorting the translucent polys + //TODO - this _MUST_ be moved later in the pipeline, after clipping. + //the w-division here is just an approximation to fix the shop in harvest moon island of happiness for(int i=0; i<polycount; i++) { POLY &poly = polylist->list[i]; - float verty = 0.0f; - poly.miny = poly.maxy = vertlist->list[poly.vertIndexes[0]].y; + float verty = vertlist->list[poly.vertIndexes[0]].y; + float vertw = vertlist->list[poly.vertIndexes[0]].w; + verty = (verty+vertw)/(2*vertw); + poly.miny = poly.maxy = (verty+vertw)/(2*vertw); for(int j=1; j<poly.type; j++) { verty = vertlist->list[poly.vertIndexes[j]].y; + vertw = vertlist->list[poly.vertIndexes[j]].w; + verty = (verty+vertw)/(2*vertw); poly.miny = min(poly.miny, verty); poly.maxy = max(poly.maxy, verty); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |