1
0
mirror of https://github.com/blawar/GLideN64.git synced 2024-07-04 10:03:36 +00:00

Add support for Anisotropic Filtering.

This commit is contained in:
Sergey Lipskiy 2015-02-05 22:05:47 +06:00
parent 553eb76efb
commit ced838fed2
4 changed files with 13 additions and 0 deletions

View File

@ -25,6 +25,7 @@ struct Config
struct
{
u32 maxAnisotropy;
f32 maxAnisotropyF;
u32 forceBilinear;
u32 maxBytes;
u32 screenShotFormat;

View File

@ -1234,6 +1234,12 @@ void OGLRender::_initExtensions()
#else
m_bImageTexture = false;
#endif
if (config.texture.maxAnisotropy != 0) {
glGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &config.texture.maxAnisotropyF);
config.texture.maxAnisotropyF = min(config.texture.maxAnisotropyF, (f32)config.texture.maxAnisotropy);
} else
config.texture.maxAnisotropyF = 0.0f;
}
void OGLRender::_initStates()

View File

@ -1126,6 +1126,9 @@ void TextureCache::activateTexture(u32 _t, CachedTexture *_pTexture)
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, _pTexture->clampS ? GL_CLAMP_TO_EDGE : _pTexture->mirrorS ? GL_MIRRORED_REPEAT : GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, _pTexture->clampT ? GL_CLAMP_TO_EDGE : _pTexture->mirrorT ? GL_MIRRORED_REPEAT : GL_REPEAT);
if (video().getRender().getRenderState() == OGLRender::rsTriangle && config.texture.maxAnisotropyF > 0.0f)
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, config.texture.maxAnisotropyF);
_pTexture->lastDList = RSP.DList;
current[_t] = _pTexture;

View File

@ -49,6 +49,8 @@ bool Config_SetDefault()
//#Texture Settings
res = ConfigSetDefaultBool(g_configVideoGliden64, "ForceBilinear", 0, "Force bilinear texture filter");
assert(res == M64ERR_SUCCESS);
res = ConfigSetDefaultBool(g_configVideoGliden64, "MaxAnisotropy", 0, "Max level of Anisotropic Filtering, 0 for off");
assert(res == M64ERR_SUCCESS);
res = ConfigSetDefaultInt(g_configVideoGliden64, "CacheSize", 500, "Size of texture cache in megabytes. Good value is VRAM*3/4");
assert(res == M64ERR_SUCCESS);
//#Emulation Settings
@ -137,6 +139,7 @@ void Config_LoadConfig()
//#Texture Settings
config.texture.forceBilinear = ConfigGetParamBool(g_configVideoGliden64, "ForceBilinear");
config.texture.maxAnisotropy = ConfigGetParamInt(g_configVideoGliden64, "MaxAnisotropy");
config.texture.maxBytes = ConfigGetParamInt(g_configVideoGliden64, "CacheSize") * uMegabyte;
//#Emulation Settings
config.generalEmulation.enableFog = ConfigGetParamBool(g_configVideoGliden64, "EnableFog");