From: havoc Date: Sat, 22 Jan 2011 23:28:01 +0000 (+0000) Subject: use texel center sampling on textures X-Git-Tag: xonotic-v0.5.0~438^2~119 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=f2e42c3bc66323db7673d8c278e9619e6efc1c71;p=xonotic%2Fdarkplaces.git use texel center sampling on textures git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@10722 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/dpsoftrast.c b/dpsoftrast.c index d08de72a..7669562b 100644 --- a/dpsoftrast.c +++ b/dpsoftrast.c @@ -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];