Add Anisotropic filtering (#644)

This commit is contained in:
VoxelTek 2025-07-24 14:23:43 +10:00 committed by GitHub
parent b69687d2f1
commit d83a729c77
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 130 additions and 49 deletions

View File

@ -88,6 +88,8 @@ CMainDialog::CMainDialog(QWidget* pParent) : QDialog(pParent)
connect(m_ui->msaaSlider, &QSlider::valueChanged, this, &CMainDialog::MSAAChanged);
connect(m_ui->msaaSlider, &QSlider::sliderMoved, this, &CMainDialog::MSAAChanged);
connect(m_ui->AFSlider, &QSlider::valueChanged, this, &CMainDialog::AFChanged);
connect(m_ui->AFSlider, &QSlider::sliderMoved, this, &CMainDialog::AFChanged);
connect(m_ui->aspectRatioComboBox, &QComboBox::currentIndexChanged, this, &CMainDialog::AspectRatioChanged);
connect(m_ui->xResSpinBox, &QSpinBox::valueChanged, this, &CMainDialog::XResChanged);
@ -321,6 +323,8 @@ void CMainDialog::UpdateInterface()
m_ui->maxActorsNum->setNum(currentConfigApp->m_max_actors);
m_ui->msaaSlider->setValue(log2(currentConfigApp->m_msaa));
m_ui->msaaNum->setNum(currentConfigApp->m_msaa);
m_ui->AFSlider->setValue(log2(currentConfigApp->m_anisotropy));
m_ui->AFNum->setNum(currentConfigApp->m_anisotropy);
}
// FUNCTION: CONFIG 0x004045e0
@ -550,6 +554,13 @@ void CMainDialog::MSAAChanged(int value)
UpdateInterface();
}
void CMainDialog::AFChanged(int value)
{
currentConfigApp->m_anisotropy = exp2(value);
m_modified = true;
UpdateInterface();
}
void CMainDialog::SelectTexturePathDialog()
{
QString texture_path = QString::fromStdString(currentConfigApp->m_texture_path);

View File

@ -61,6 +61,7 @@ private slots:
void MaxLoDChanged(int value);
void MaxActorsChanged(int value);
void MSAAChanged(int value);
void AFChanged(int value);
void SelectTexturePathDialog();
void TexturePathEdited();
void XResChanged(int i);

View File

@ -85,6 +85,7 @@ bool CConfigApp::InitInstance()
m_joystick_index = -1;
m_display_bit_depth = 16;
m_msaa = 1;
m_anisotropy = 1;
m_haptic = TRUE;
m_touch_scheme = 2;
m_texture_load = TRUE;
@ -184,6 +185,7 @@ bool CConfigApp::ReadRegisterSettings()
m_max_lod = iniparser_getdouble(dict, "isle:Max LOD", m_max_lod);
m_max_actors = iniparser_getint(dict, "isle:Max Allowed Extras", m_max_actors);
m_msaa = iniparser_getint(dict, "isle:MSAA", m_msaa);
m_anisotropy = iniparser_getint(dict, "isle:Anisotropic", m_anisotropy);
m_texture_load = iniparser_getboolean(dict, "extensions:texture loader", m_texture_load);
m_texture_path = iniparser_getstring(dict, "texture loader:texture path", m_texture_path.c_str());
m_aspect_ratio = iniparser_getint(dict, "isle:Aspect Ratio", m_aspect_ratio);
@ -281,6 +283,18 @@ bool CConfigApp::ValidateSettings()
m_msaa = 1;
is_modified = TRUE;
}
if (!(m_anisotropy & (m_anisotropy - 1))) { // Check if anisotropy is power of 2 (1, 2, 4, 8, etc)
m_anisotropy = exp2(round(log2(m_anisotropy))); // Closest power of 2
is_modified = TRUE;
}
if (m_anisotropy > 16) {
m_anisotropy = 16;
is_modified = TRUE;
}
else if (m_anisotropy < 1) {
m_anisotropy = 1;
is_modified = TRUE;
}
return is_modified;
}
@ -360,6 +374,7 @@ void CConfigApp::WriteRegisterSettings() const
SetIniInt(dict, "isle:Display Bit Depth", m_display_bit_depth);
SetIniInt(dict, "isle:MSAA", m_msaa);
SetIniInt(dict, "isle:Anisotropic", m_anisotropy);
SetIniBool(dict, "isle:Flip Surfaces", m_flip_surfaces);
SetIniBool(dict, "isle:Full Screen", m_full_screen);
SetIniBool(dict, "isle:Exclusive Full Screen", m_exclusive_full_screen);

View File

@ -71,6 +71,7 @@ public:
Direct3DDeviceInfo* m_device;
int m_display_bit_depth;
int m_msaa;
int m_anisotropy;
bool m_flip_surfaces;
bool m_full_screen;
bool m_exclusive_full_screen;

View File

@ -631,7 +631,7 @@ The game will gradually increase the number of actors until this maximum is reac
</property>
<layout class="QVBoxLayout" name="fullscreenRadioContainer">
<property name="spacing">
<number>3</number>
<number>6</number>
</property>
<property name="leftMargin">
<number>0</number>
@ -822,6 +822,21 @@ The game will gradually increase the number of actors until this maximum is reac
</layout>
</widget>
</item>
<item>
<widget class="QWidget" name="msaaAFBox" native="true">
<layout class="QHBoxLayout" name="horizontalLayout_10">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QGroupBox" name="msaaBox">
<property name="title">
@ -870,17 +885,54 @@ The game will gradually increase the number of actors until this maximum is reac
</widget>
</item>
<item>
<spacer name="verticalSpacer_4">
<property name="orientation">
<enum>Qt::Orientation::Vertical</enum>
<widget class="QGroupBox" name="AFBox">
<property name="title">
<string>Anisotropic Filtering</string>
</property>
<property name="sizeHint" stdset="0">
<layout class="QHBoxLayout" name="horizontalLayout_11">
<item>
<widget class="QSlider" name="AFSlider">
<property name="minimum">
<number>0</number>
</property>
<property name="maximum">
<number>4</number>
</property>
<property name="pageStep">
<number>1</number>
</property>
<property name="orientation">
<enum>Qt::Orientation::Horizontal</enum>
</property>
<property name="tickPosition">
<enum>QSlider::TickPosition::TicksBothSides</enum>
</property>
<property name="tickInterval">
<number>1</number>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="AFNum">
<property name="minimumSize">
<size>
<width>20</width>
<width>16</width>
<height>0</height>
</size>
</property>
</spacer>
<property name="text">
<string>1</string>
</property>
<property name="alignment">
<set>Qt::AlignmentFlag::AlignCenter</set>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
@ -1121,6 +1173,7 @@ The game will gradually increase the number of actors until this maximum is reac
<tabstop>yResSpinBox</tabstop>
<tabstop>exFullResComboBox</tabstop>
<tabstop>msaaSlider</tabstop>
<tabstop>AFSlider</tabstop>
<tabstop>touchComboBox</tabstop>
<tabstop>rumbleCheckBox</tabstop>
<tabstop>textureCheckBox</tabstop>