mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-12-01 00:21:43 +00:00
Fix mipmap sampling bug
This commit is contained in:
parent
356830a8c8
commit
90c8b3370a
2 changed files with 3 additions and 3 deletions
|
@ -1073,7 +1073,7 @@ extern "C" BYTE *ds_curcolormap, *ds_cursource, *ds_curtiltedsource;
|
||||||
void R_SetSpanSource(FTexture *tex)
|
void R_SetSpanSource(FTexture *tex)
|
||||||
{
|
{
|
||||||
ds_source = r_swtruecolor ? (const BYTE*)tex->GetPixelsBgra() : tex->GetPixels();
|
ds_source = r_swtruecolor ? (const BYTE*)tex->GetPixelsBgra() : tex->GetPixels();
|
||||||
ds_source_mipmapped = tex->Mipmapped();
|
ds_source_mipmapped = tex->Mipmapped() && tex->GetWidth() > 1 && tex->GetHeight() > 1;
|
||||||
#ifdef X86_ASM
|
#ifdef X86_ASM
|
||||||
if (!r_swtruecolor && ds_cursource != ds_source)
|
if (!r_swtruecolor && ds_cursource != ds_source)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1159,12 +1159,12 @@ WallscanSampler::WallscanSampler(int y1, float swal, double yrepeat, fixed_t xof
|
||||||
int mipmap_offset = 0;
|
int mipmap_offset = 0;
|
||||||
int mip_width = texture->GetWidth();
|
int mip_width = texture->GetWidth();
|
||||||
int mip_height = texture->GetHeight();
|
int mip_height = texture->GetHeight();
|
||||||
if (r_mipmap && texture->Mipmapped())
|
if (r_mipmap && texture->Mipmapped() && mip_width > 1 && mip_height > 1)
|
||||||
{
|
{
|
||||||
uint32_t xpos = (uint32_t)((((uint64_t)xoffset) << FRACBITS) / mip_width);
|
uint32_t xpos = (uint32_t)((((uint64_t)xoffset) << FRACBITS) / mip_width);
|
||||||
double texture_bias = 1.7f;
|
double texture_bias = 1.7f;
|
||||||
double level = MAX(magnitude - 3.0, 0.0);
|
double level = MAX(magnitude - 3.0, 0.0);
|
||||||
while (level > texture_bias)
|
while (level > texture_bias && mip_width > 1 && mip_height > 1)
|
||||||
{
|
{
|
||||||
mipmap_offset += mip_width * mip_height;
|
mipmap_offset += mip_width * mip_height;
|
||||||
level *= 0.5f;
|
level *= 0.5f;
|
||||||
|
|
Loading…
Reference in a new issue