softgpu: Fix some bugs, committing stuff before it breaks again...

This commit is contained in:
Tony Wasserka authored and neobrain committed 2013-08-16 23:48:54 +02:00
1 parent a4af6d4bc4
commit 209e040b73
2 files changed
+95 -11

No files matched your search

+11 -5
View File
@@ -51,16 +51,22 @@ ScreenCoords TransformUnit::ClipToScreen(const ClipCoords& coords)
float viewport_dz = vpz2 - vpz1; // TODO: -1?
// TODO: Check for invalid parameters (x2 < x1, etc)
ret.x = (coords.x * viewport_dx / coords.w + vpx1) * 0xFFFF;
ret.y = (coords.y * viewport_dy / coords.w + vpy1) * 0xFFFF;
ret.z = (coords.z * viewport_dz / coords.w + vpz1) * 0xFFFF;
ret.x = (coords.x * vpx1 / coords.w + vpx2) * 0xFFFF;
ret.y = (coords.y * vpy1 / coords.w + vpy2) * 0xFFFF;
ret.z = (coords.z * vpy1 / coords.w + vpz2) * 0xFFFF;
return ret;
}
DrawingCoords TransformUnit::ScreenToDrawing(const ScreenCoords& coords)
{
DrawingCoords ret;
ret.x = (coords.x - gstate.offsetx) & 0x3ff;
ret.y = (coords.y - gstate.offsety) & 0x3ff;
/* ret.x = ((coords.x - gstate.offsetx*16)) & 0x3ff;
ret.y = ((coords.y - gstate.offsety*16)) & 0x3ff;
ret.x /= 4.f;
ret.y /= 4.f;*/
ret.x = (((u32)coords.x + (2048<<4) - (gstate.offsetx&0xffff))/16);// & 0x3ff;
ret.y = (((u32)coords.y + (2048<<4) - (gstate.offsety&0xffff))/16);// & 0x3ff;
ret.x /= 16.f;
ret.y /= 16.f;
return ret;
}