- For compatibility with the software renderer, D3DFB::DrawTextureV needs to

truncate the coordinates to integers before sending them to the hardware.
  Otherwise, there can be one pixel gaps compared to the software renderer,
  because the hardware is rounding to nearest but the software renderer is
  simply truncating the fractional part of the coordinate. This is the real
  cause of the gap above the status bar at 1152x864 (and another gap to the
  left of the status bar at 800x500).
- Fixed: When D3DFB::DrawTextureV had to clip a tile, it adjusted the 
  texture coordinates erroneously, still using the old calculations from
  before texture packing was implemented.


SVN r695 (trunk)
This commit is contained in:
Randy Heit 2008-01-12 02:12:09 +00:00
parent ce388163e1
commit 88549aebcd
4 changed files with 640 additions and 629 deletions

View file

@ -1,4 +1,14 @@
January 11, 2008 January 11, 2008
- For compatibility with the software renderer, D3DFB::DrawTextureV needs to
truncate the coordinates to integers before sending them to the hardware.
Otherwise, there can be one pixel gaps compared to the software renderer,
because the hardware is rounding to nearest but the software renderer is
simply truncating the fractional part of the coordinate. This is the real
cause of the gap at the top of the status bar at 1152x864 (and another gap
to the left of the status bar at 800x500).
- Fixed: When D3DFB::DrawTextureV had to clip a tile, it adjusted the
texture coordinates erroneously, still using the old calculations from
before texture packing was implemented.
- Moved thingdef_codeptr.cpp into thingdef/ with the other thingdef files. - Moved thingdef_codeptr.cpp into thingdef/ with the other thingdef files.
January 11, 2008 (Changes by Graf Zahl) January 11, 2008 (Changes by Graf Zahl)

View file

@ -213,9 +213,6 @@ void FBaseStatusBar::SetScaled (bool scale)
::ST_Y = Scale(ST_Y - 100, SCREENHEIGHT*3, BaseRatioSizes[4][1]) + SCREENHEIGHT/2 ::ST_Y = Scale(ST_Y - 100, SCREENHEIGHT*3, BaseRatioSizes[4][1]) + SCREENHEIGHT/2
+ (SCREENHEIGHT - SCREENHEIGHT * BaseRatioSizes[4][3] / 48) / 2; + (SCREENHEIGHT - SCREENHEIGHT * BaseRatioSizes[4][3] / 48) / 2;
} }
// If this is odd, add one to make it even and close the gap between the
// status bar and the rest of the screen
::ST_Y += (::ST_Y & 1);
Displacement = 0; Displacement = 0;
} }
::ST_X = ST_X; ::ST_X = ST_X;

View file

@ -2160,8 +2160,8 @@ void STACK_ARGS D3DFB::DrawTextureV (FTexture *img, int x, int y, uint32 tags_fi
float v0 = tex->Box->Top; float v0 = tex->Box->Top;
float u1 = tex->Box->Right; float u1 = tex->Box->Right;
float v1 = tex->Box->Bottom; float v1 = tex->Box->Bottom;
float uscale = 1.f / (parms.texwidth / u1); float uscale = 1.f / tex->Box->Owner->Width;
float vscale = 1.f / (parms.texheight / v1) / yscale; float vscale = 1.f / tex->Box->Owner->Height / yscale;
if (y0 < parms.uclip) if (y0 < parms.uclip)
{ {
@ -2210,10 +2210,14 @@ void STACK_ARGS D3DFB::DrawTextureV (FTexture *img, int x, int y, uint32 tags_fi
} }
float yoffs = GatheringWipeScreen ? 0.5f : 0.5f - LBOffset; float yoffs = GatheringWipeScreen ? 0.5f : 0.5f - LBOffset;
x0 -= 0.5f;
y0 -= yoffs; // Coordinates are truncated to integers, because that's effectively
x1 -= 0.5f; // what the software renderer does. The hardware will instead round
y1 -= yoffs; // to nearest, it seems.
x0 = floorf(x0) - 0.5f;
y0 = floorf(y0) - yoffs;
x1 = floorf(x1) - 0.5f;
y1 = floorf(y1) - yoffs;
FBVERTEX *vert = &VertexData[VertexPos]; FBVERTEX *vert = &VertexData[VertexPos];

File diff suppressed because it is too large Load diff