Use po2 patches to fix mipmaps
This commit is contained in:
1 parent
e4ec7484aa
commit
d4f2202906
1 file changed
+20
-8
+20
-8
@@ -172,13 +172,18 @@ static void HWR_DrawPatchInCache(GLMipmap_t *mipmap,
|
||||
|
||||
palette = HWR_GetTexturePalette();
|
||||
|
||||
ncols = (pwidth * pblockwidth) / pwidth;
|
||||
//ncols = (pwidth * pblockwidth) / pwidth;
|
||||
ncols = pwidth;
|
||||
|
||||
// source advance
|
||||
xfrac = 0;
|
||||
xfracstep = (pwidth << FRACBITS) / pblockwidth;
|
||||
yfracstep = (pheight << FRACBITS) / pblockheight;
|
||||
scale_y = (pblockheight << FRACBITS) / pheight;
|
||||
//xfracstep = (pwidth << FRACBITS) / pblockwidth;
|
||||
//yfracstep = (pheight << FRACBITS) / pblockheight;
|
||||
//scale_y = (pblockheight << FRACBITS) / pheight;
|
||||
|
||||
xfracstep = FRACUNIT;
|
||||
yfracstep = FRACUNIT;
|
||||
scale_y = FRACUNIT;
|
||||
|
||||
bpp = format2bpp(mipmap->format);
|
||||
|
||||
@@ -425,13 +430,20 @@ void HWR_MakePatch (patch_t *patch, GLPatch_t *grPatch, GLMipmap_t *grMipmap, bo
|
||||
grPatch->leftoffset = SHORT(patch->leftoffset);
|
||||
grPatch->topoffset = SHORT(patch->topoffset);
|
||||
|
||||
grMipmap->width = (UINT16)SHORT(patch->width);
|
||||
grMipmap->height = (UINT16)SHORT(patch->height);
|
||||
//grMipmap->width = (UINT16)SHORT(patch->width);
|
||||
//grMipmap->height = (UINT16)SHORT(patch->height);
|
||||
grMipmap->width = grMipmap->height = 1;
|
||||
while (grMipmap->width < grPatch->width) grMipmap->width <<= 1;
|
||||
while (grMipmap->height < grPatch->height) grMipmap->height <<= 1;
|
||||
|
||||
// no wrap around, no chroma key
|
||||
grMipmap->flags = 0;
|
||||
// setup the texture info
|
||||
grMipmap->format = patchformat;
|
||||
|
||||
//grPatch->max_s = grPatch->max_t = 1.0f;
|
||||
grPatch->max_s = (float)grPatch->width / (float)grMipmap->width;
|
||||
grPatch->max_t = (float)grPatch->height / (float)grMipmap->height;
|
||||
}
|
||||
|
||||
Z_Free(grMipmap->data);
|
||||
@@ -441,12 +453,12 @@ void HWR_MakePatch (patch_t *patch, GLPatch_t *grPatch, GLMipmap_t *grMipmap, bo
|
||||
{
|
||||
MakeBlock(grMipmap);
|
||||
HWR_DrawPatchInCache(grMipmap,
|
||||
grPatch->width, grPatch->height,
|
||||
grMipmap->width, grMipmap->height,
|
||||
grPatch->width, grPatch->height,
|
||||
patch);
|
||||
}
|
||||
|
||||
grPatch->max_s = grPatch->max_t = 1.0f;
|
||||
//grPatch->max_s = grPatch->max_t = 1.0f;
|
||||
}
|
||||
|
||||
// =================================================
|
||||
|
||||
Reference in new issue
Block a user