From 828c65dcb545f83c04efbae11df5e772c6529ff1 Mon Sep 17 00:00:00 2001 From: Vasilii Shirokii Date: Sun, 24 Dec 2023 20:00:35 +0000 Subject: [PATCH] Texture filtering on/off cvar --- src/common/rendering/rt/rt_main.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/common/rendering/rt/rt_main.cpp b/src/common/rendering/rt/rt_main.cpp index 138d38c04..d70722462 100644 --- a/src/common/rendering/rt/rt_main.cpp +++ b/src/common/rendering/rt/rt_main.cpp @@ -108,6 +108,7 @@ namespace cvar RT_CVAR( rt_emis_mapboost, 200.f, "indirect illumination emissiveness" ) RT_CVAR( rt_emis_maxscrcolor, 10.f, "burn on-screen emissive colors" ) RT_CVAR( rt_emis_additive_dflt, 0.5f, "emission value for objects with additive blending" ) + RT_CVAR( rt_smoothtextures, false, "enable linear texture filtering" ) RT_CVAR( rt_tnmp_ev100_min, 2.f, "min brightness for auto-exposure" ) RT_CVAR( rt_tnmp_ev100_max, 7.7f, "max brightness for auto-exposure" ) @@ -736,7 +737,7 @@ class RTHardwareTexture : public IHardwareTexture .pPixels = texbuffer.mBuffer, .size = { static_cast< uint32_t >( texbuffer.mWidth ), static_cast< uint32_t >( texbuffer.mHeight ) }, - .filter = RG_SAMPLER_FILTER_NEAREST, + .filter = RG_SAMPLER_FILTER_AUTO, .addressModeU = RG_SAMPLER_ADDRESS_MODE_REPEAT, // rtclamp_x( clampmode ), .addressModeV = RG_SAMPLER_ADDRESS_MODE_REPEAT, // rtclamp_y( clampmode ), }; @@ -2250,9 +2251,10 @@ void RTFrameBuffer::RT_DrawFrame() }; auto texture_params = RgDrawFrameTexturesParams{ - .sType = RG_STRUCTURE_TYPE_DRAW_FRAME_TEXTURES_PARAMS, - .pNext = &volumetrics_params, - .dynamicSamplerFilter = RG_SAMPLER_FILTER_NEAREST, + .sType = RG_STRUCTURE_TYPE_DRAW_FRAME_TEXTURES_PARAMS, + .pNext = &volumetrics_params, + .dynamicSamplerFilter = + cvar::rt_smoothtextures ? RG_SAMPLER_FILTER_LINEAR : RG_SAMPLER_FILTER_NEAREST, .normalMapStrength = cvar::rt_normalmap_stren, .emissionMapBoost = cvar::rt_emis_mapboost, .emissionMaxScreenColor = cvar::rt_emis_maxscrcolor,