From 5fa879d5d103dbfc5e6ae4ee6b16c9feef6797cd Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 19 Oct 2019 19:29:59 +0200 Subject: [PATCH] - use texture clamping for skies, because these textures do not always wrap. --- source/build/include/polymost.h | 1 + source/build/src/polymost.cpp | 2 +- source/build/src/texcache.cpp | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/source/build/include/polymost.h b/source/build/include/polymost.h index 4ad5fdc85..0eeffbf35 100644 --- a/source/build/include/polymost.h +++ b/source/build/include/polymost.h @@ -116,6 +116,7 @@ enum { DAMETH_CLAMPED = 4, DAMETH_MODEL = 8, + DAMETH_SKY = 16, DAMETH_WALL = 32, // signals a texture for a wall (for r_npotwallmode) diff --git a/source/build/src/polymost.cpp b/source/build/src/polymost.cpp index 108626ca2..cf418d7a9 100644 --- a/source/build/src/polymost.cpp +++ b/source/build/src/polymost.cpp @@ -503,7 +503,7 @@ static void polymost_drawpoly(vec2f_t const * const dpxy, int32_t const n, int32 static int32_t skyzbufferhack_pass = 0; if (flatskyrender && skyzbufferhack_pass == 0) { - polymost_flatskyrender(dpxy, n, method, tilesize); + polymost_flatskyrender(dpxy, n, method|DAMETH_SKY, tilesize); return; } diff --git a/source/build/src/texcache.cpp b/source/build/src/texcache.cpp index 4d47805a3..caabb05a8 100644 --- a/source/build/src/texcache.cpp +++ b/source/build/src/texcache.cpp @@ -156,7 +156,7 @@ bool GLInstance::SetTextureInternal(int picnum, FTexture* tex, int palette, int auto mtex = LoadTexture(tex, TextureType, lookuppal); if (mtex) { - auto sampler = (method & DAMETH_CLAMPED) ? (sampleroverride != -1 ? sampleroverride : SamplerClampXY) : SamplerRepeat; + auto sampler = method & DAMETH_SKY? SamplerClampXY : (method & DAMETH_CLAMPED) ? (sampleroverride != -1 ? sampleroverride : SamplerClampXY) : SamplerRepeat; if (TextureType == TT_INDEXED) sampler = sampler + SamplerNoFilterRepeat - SamplerRepeat; BindTexture(0, mtex, sampler);