Make level of anisotropic configurable, plus default to x8 (previously, was using maximum available which could use a lot more video memory with no need since above x8 the improvement is minor). Also remove some debug code that is no more used.

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@10499 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
auria 2011-12-27 19:49:03 +00:00
parent aee0da7a01
commit c45e9be77d
5 changed files with 43 additions and 49 deletions

View File

@ -33,7 +33,7 @@
<div layout="horizontal-row" width="100%" height="fit">
<label text="Texture filtering" I18N="Video settings"/>
<spacer width="10" height="10"/>
<gauge id="filtering" min_value="0" max_value="2" width="50%" />
<gauge id="filtering" min_value="0" max_value="5" width="50%" />
</div>
<spacer height="5" width="10" />

View File

@ -461,11 +461,10 @@ namespace UserConfigParams
"steering_animations", &m_graphics_quality,
"Whether to display kart animations (0=disabled for all; "
"1=enabled for humans, disabled for AIs; 2=enabled for all") );
PARAM_PREFIX BoolUserConfigParam m_anisotropic
PARAM_DEFAULT( BoolUserConfigParam(true, "anisotropic",
PARAM_PREFIX IntUserConfigParam m_anisotropic
PARAM_DEFAULT( IntUserConfigParam(8, "anisotropic",
&m_graphics_quality,
"Whether anisotropic filtering is allowed to be "
"used (true or false)") );
"Quality of anisotropic filtering (usual values include 2-4-8-16; 0 to disable)") );
PARAM_PREFIX BoolUserConfigParam m_trilinear
PARAM_DEFAULT( BoolUserConfigParam(true, "trilinear",
&m_graphics_quality,

View File

@ -875,9 +875,13 @@ void Material::setMaterialProperties(video::SMaterial *m)
}
#endif
if (UserConfigParams::m_anisotropic)
if (UserConfigParams::m_anisotropic > 0)
{
m->setFlag(video::EMF_ANISOTROPIC_FILTER, true);
for (u32 i=0; i<video::MATERIAL_MAX_TEXTURES; ++i)
{
m->TextureLayer[i].AnisotropicFilter =
UserConfigParams::m_anisotropic;
}
}
else if (UserConfigParams::m_trilinear)
{

View File

@ -78,47 +78,19 @@ void MaterialManager::setAllMaterialFlags(video::ITexture* t,
{
if (m_materials[i]->getTexFname()==image)
{
// ---- lightmap debug
#if LIGHTMAP_VISUALISATION
if (mb->getVertexType() == video::EVT_2TCOORDS)
{
if (g_processed.find(mb) == g_processed.end())
{
g_processed.insert(mb);
video::S3DVertex2TCoords* coords = (video::S3DVertex2TCoords*)mb->getVertices();
for (unsigned int v=0; v<mb->getVertexCount(); v++)
{
core::vector2d<f32> tmp = coords[v].TCoords2;
coords[v].TCoords2 = coords[v].TCoords;
coords[v].TCoords = tmp;
}
}
// atm this mode assumes lightmap textures will have 'lightmap' in their name
if (mb->getMaterial().getTexture(1) != NULL &&
mb->getMaterial().getTexture(1)->getName().getPath().find("lightmap") != -1)
{
//video::ITexture* tmp = mb->getMaterial().getTexture(0);
mb->getMaterial().setTexture(0, mb->getMaterial().getTexture(1));
//mb->getMaterial().setTexture(1, tmp);
mb->setDirty();
}
} else
#endif
// --------------------
m_materials[i]->setMaterialProperties(&(mb->getMaterial()));
return;
}
} // for i
// This material does not appear in materials.xml. Set some common flags...
if (UserConfigParams::m_anisotropic)
if (UserConfigParams::m_anisotropic > 0)
{
mb->getMaterial().setFlag(video::EMF_ANISOTROPIC_FILTER, true);
for (u32 i=0; i<video::MATERIAL_MAX_TEXTURES; ++i)
{
mb->getMaterial().TextureLayer[i].AnisotropicFilter =
UserConfigParams::m_anisotropic;
}
}
else if (UserConfigParams::m_trilinear)
{

View File

@ -62,11 +62,18 @@ void CustomVideoSettingsialog::beforeAddingWidgets()
SpinnerWidget* filtering = getWidget<SpinnerWidget>("filtering");
int value = 0;
if (UserConfigParams::m_anisotropic) value = 2;
else if (UserConfigParams::m_trilinear) value = 1;
filtering->addLabel( L"Bilinear" ); // 0
filtering->addLabel( L"Trilinear" ); // 1
filtering->addLabel( L"Anisotropic" ); // 2
if (UserConfigParams::m_anisotropic == 2) value = 2;
else if (UserConfigParams::m_anisotropic == 4) value = 3;
else if (UserConfigParams::m_anisotropic == 8) value = 4;
else if (UserConfigParams::m_anisotropic == 16) value = 5;
else if (UserConfigParams::m_trilinear) value = 1;
filtering->addLabel( L"Bilinear" ); // 0
filtering->addLabel( L"Trilinear" ); // 1
filtering->addLabel( L"Anisotropic x2" ); // 2
filtering->addLabel( L"Anisotropic x4" ); // 3
filtering->addLabel( L"Anisotropic x8" ); // 4
filtering->addLabel( L"Anisotropic x16" ); // 5
filtering->setValue( value );
getWidget<CheckBoxWidget>("antialiasing")->setState( UserConfigParams::m_fullscreen_antialiasing );
@ -96,15 +103,27 @@ GUIEngine::EventPropagation CustomVideoSettingsialog::processEvent(const std::st
switch (getWidget<SpinnerWidget>("filtering")->getValue())
{
case 0:
UserConfigParams::m_anisotropic = false;
UserConfigParams::m_anisotropic = 0;
UserConfigParams::m_trilinear = false;
break;
case 1:
UserConfigParams::m_anisotropic = false;
UserConfigParams::m_anisotropic = 0;
UserConfigParams::m_trilinear = true;
break;
case 2:
UserConfigParams::m_anisotropic = true;
UserConfigParams::m_anisotropic = 2;
UserConfigParams::m_trilinear = true;
break;
case 3:
UserConfigParams::m_anisotropic = 4;
UserConfigParams::m_trilinear = true;
break;
case 4:
UserConfigParams::m_anisotropic = 8;
UserConfigParams::m_trilinear = true;
break;
case 5:
UserConfigParams::m_anisotropic = 16;
UserConfigParams::m_trilinear = true;
break;
}