From f2e42c3bc66323db7673d8c278e9619e6efc1c71 Mon Sep 17 00:00:00 2001 From: havoc Date: Sat, 22 Jan 2011 23:28:01 +0000 Subject: [PATCH] use texel center sampling on textures git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@10722 d7cf8633-e32d-0410-b094-e92efae38249 --- dpsoftrast.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) 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]; -- 2.39.2