]> de.git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
use texel center sampling on textures
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Sat, 22 Jan 2011 23:28:01 +0000 (23:28 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Sat, 22 Jan 2011 23:28:01 +0000 (23:28 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@10722 d7cf8633-e32d-0410-b094-e92efae38249

dpsoftrast.c

index d08de72ac0e11c81ae7483dde4e6db8e23774c04..7669562b95bc31c9afcbc6367fabd263952267fb 100644 (file)
@@ -1401,8 +1401,8 @@ void DPSOFTRAST_Draw_Span_Texture2DVarying(const DPSOFTRAST_State_Draw_Span *spa
                        for (x = startx;x < endx;x++)
                        {
                                z = zf[x];
-                               tc[0] = (data[0] + slope[0]*x) * z * tcscale[0];
-                               tc[1] = (data[1] + slope[1]*x) * z * tcscale[1];
+                               tc[0] = (data[0] + slope[0]*x) * z * tcscale[0] - 0.5f;
+                               tc[1] = (data[1] + slope[1]*x) * z * tcscale[1] - 0.5f;
                                tci[0] = (int)floor(tc[0]);
                                tci[1] = (int)floor(tc[1]);
                                tci1[0] = tci[0] + 1;
@@ -1436,8 +1436,8 @@ void DPSOFTRAST_Draw_Span_Texture2DVarying(const DPSOFTRAST_State_Draw_Span *spa
                        for (x = startx;x < endx;x++)
                        {
                                z = zf[x];
-                               tc[0] = (data[0] + slope[0]*x) * z * tcscale[0];
-                               tc[1] = (data[1] + slope[1]*x) * z * tcscale[1];
+                               tc[0] = (data[0] + slope[0]*x) * z * tcscale[0] - 0.5f;
+                               tc[1] = (data[1] + slope[1]*x) * z * tcscale[1] - 0.5f;
                                tci[0] = (int)floor(tc[0]);
                                tci[1] = (int)floor(tc[1]);
                                tci1[0] = tci[0] + 1;
@@ -1474,8 +1474,8 @@ void DPSOFTRAST_Draw_Span_Texture2DVarying(const DPSOFTRAST_State_Draw_Span *spa
                        for (x = startx;x < endx;x++)
                        {
                                z = zf[x];
-                               tc[0] = (data[0] + slope[0]*x) * z * tcscale[0];
-                               tc[1] = (data[1] + slope[1]*x) * z * tcscale[1];
+                               tc[0] = (data[0] + slope[0]*x) * z * tcscale[0] - 0.5f;
+                               tc[1] = (data[1] + slope[1]*x) * z * tcscale[1] - 0.5f;
                                tci[0] = (int)floor(tc[0]);
                                tci[1] = (int)floor(tc[1]);
                                tci[0] = tci[0] >= tcimin[0] ? (tci[0] <= tcimax[0] ? tci[0] : tcimax[0]) : tcimin[0];
@@ -1496,8 +1496,8 @@ void DPSOFTRAST_Draw_Span_Texture2DVarying(const DPSOFTRAST_State_Draw_Span *spa
                        for (x = startx;x < endx;x++)
                        {
                                z = zf[x];
-                               tc[0] = (data[0] + slope[0]*x) * z * tcscale[0];
-                               tc[1] = (data[1] + slope[1]*x) * z * tcscale[1];
+                               tc[0] = (data[0] + slope[0]*x) * z * tcscale[0] - 0.5f;
+                               tc[1] = (data[1] + slope[1]*x) * z * tcscale[1] - 0.5f;
                                tci[0] = (int)floor(tc[0]);
                                tci[1] = (int)floor(tc[1]);
                                tci[0] &= tciwrapmask[0];