Added: Bilinear filtering option for texture atlas textures
--HG-- branch : experimental-ui-scaling
This commit is contained in:
parent
87aa86e016
commit
5e1c6cd287
6 changed files with 12 additions and 2 deletions
|
@ -181,6 +181,7 @@ namespace NLGUI
|
|||
*/
|
||||
void setInterfaceScale(float scale, sint32 width = 0, sint32 height = 0);
|
||||
float getInterfaceScale() const { return _InterfaceScale; }
|
||||
void setBilinearFiltering(bool b) { _Bilinear = b; }
|
||||
|
||||
/*
|
||||
* is the Screen minimized?
|
||||
|
@ -537,6 +538,7 @@ namespace NLGUI
|
|||
float _InterfaceUserScale;
|
||||
sint32 _InterfaceBaseW, _InterfaceBaseH;
|
||||
sint32 _EffectiveScreenW, _EffectiveScreenH;
|
||||
bool _Bilinear;
|
||||
|
||||
void updateInterfaceScale();
|
||||
|
||||
|
|
|
@ -199,6 +199,7 @@ namespace NLGUI
|
|||
_EmptyLayer[i]= true;
|
||||
}
|
||||
_BlankGlobalTexture = NULL;
|
||||
_Bilinear = false;
|
||||
|
||||
updateInterfaceScale();
|
||||
}
|
||||
|
@ -1279,7 +1280,7 @@ namespace NLGUI
|
|||
_Material.setTexture(0, ite->Texture);
|
||||
|
||||
// Special Case if _WorldSpaceTransformation and _WorldSpaceScale, enable bilinear
|
||||
if(_WorldSpaceTransformation && _WorldSpaceScale)
|
||||
if(_Bilinear || (_WorldSpaceTransformation && _WorldSpaceScale))
|
||||
ite->Texture->setFilterMode(UTexture::Linear, UTexture::LinearMipMapOff);
|
||||
|
||||
// draw quads and empty list
|
||||
|
@ -1296,7 +1297,7 @@ namespace NLGUI
|
|||
}
|
||||
|
||||
// Special Case if _WorldSpaceTransformation and _WorldSpaceScale, reset
|
||||
if(_WorldSpaceTransformation && _WorldSpaceScale)
|
||||
if(_Bilinear || (_WorldSpaceTransformation && _WorldSpaceScale))
|
||||
ite->Texture->setFilterMode(UTexture::Nearest, UTexture::NearestMipMapOff);
|
||||
}
|
||||
if (!layer.FilteredAlphaBlendedQuads.empty() ||
|
||||
|
|
|
@ -301,6 +301,7 @@ CClientConfig::CClientConfig()
|
|||
Gamma = 0.f; // Default Monitor Gamma.
|
||||
|
||||
InterfaceScale = 1.0f; // Resize UI
|
||||
BilinearUI = false;
|
||||
|
||||
VREnable = false;
|
||||
VRDisplayDevice = "Auto";
|
||||
|
@ -839,6 +840,7 @@ void CClientConfig::setValues()
|
|||
READ_FLOAT_FV(InterfaceScale);
|
||||
// 50% smaller / 2x bigger
|
||||
clamp(ClientCfg.InterfaceScale, 0.5f, 2.0f);
|
||||
READ_BOOL_FV(BilinearUI);
|
||||
// 3D Driver
|
||||
varPtr = ClientCfg.ConfigFile.getVarPtr ("Driver3D");
|
||||
if (varPtr)
|
||||
|
|
|
@ -148,6 +148,7 @@ struct CClientConfig
|
|||
|
||||
// UI scaling
|
||||
float InterfaceScale;
|
||||
bool BilinearUI;
|
||||
|
||||
// VR
|
||||
bool VREnable;
|
||||
|
|
|
@ -1317,6 +1317,7 @@ void prelogInit()
|
|||
|
||||
CInterfaceManager::getInstance();
|
||||
CViewRenderer::getInstance()->setInterfaceScale(1.0f, 1024, 768);
|
||||
CViewRenderer::getInstance()->setBilinearFiltering(ClientCfg.BilinearUI);
|
||||
|
||||
// Yoyo: initialize NOW the InputHandler for Event filtering.
|
||||
CInputHandlerManager *InputHandlerManager = CInputHandlerManager::getInstance();
|
||||
|
|
|
@ -104,6 +104,9 @@ void updateFromClientCfg()
|
|||
if (ClientCfg.InterfaceScale != LastClientCfg.InterfaceScale)
|
||||
CInterfaceManager::getInstance()->setInterfaceScale(ClientCfg.InterfaceScale);
|
||||
|
||||
if (ClientCfg.BilinearUI != LastClientCfg.BilinearUI)
|
||||
CViewRenderer::getInstance()->setBilinearFiltering(ClientCfg.BilinearUI);
|
||||
|
||||
//---------------------------------------------------
|
||||
if (ClientCfg.WaitVBL != LastClientCfg.WaitVBL)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue