Added MSAA to settings screen

master
krzys-h 2015-07-20 16:29:09 +02:00
parent 90756f8b34
commit e2ebcb769e
19 changed files with 182 additions and 3 deletions

View File

@ -420,6 +420,18 @@ msgstr ""
msgid "Autosave slots\\How many autosave slots you'll have"
msgstr ""
msgid "Texture filtering\\Texture filtering"
msgstr ""
msgid "Mipmap level\\Mipmap level"
msgstr ""
msgid "Anisotropy level\\Anisotropy level"
msgstr ""
msgid "MSAA\\Multisample anti-aliasing"
msgstr ""
msgid "Standard controls\\Standard key functions"
msgstr ""

View File

@ -133,6 +133,9 @@ msgstr "Analyse vollendet"
msgid "Analyzes only organic matter"
msgstr "Analysiert nur Orgastoff"
msgid "Anisotropy level\\Anisotropy level"
msgstr ""
msgid "Ant"
msgstr "Ameise"
@ -831,6 +834,9 @@ msgstr "Min.\\Minimale Qualität (großes Framerate)"
msgid "Lunar Roving Vehicle"
msgstr "Lunar Roving Vehicle"
msgid "MSAA\\Multisample anti-aliasing"
msgstr ""
msgid "Marks on the ground\\Marks on the ground"
msgstr "Markierungen\\Markierungen auf dem Boden"
@ -840,6 +846,9 @@ msgstr "Großes Fenster"
msgid "Minimize"
msgstr "Reduzieren"
msgid "Mipmap level\\Mipmap level"
msgstr ""
msgid "Mission name"
msgstr "Name der Mission"
@ -1464,6 +1473,9 @@ msgstr "Zielscheibe"
msgid "Target bot"
msgstr "Mobile Zielscheibe"
msgid "Texture filtering\\Texture filtering"
msgstr ""
msgid "The expression must return a boolean value"
msgstr "Der Ausdruck muss einen boolschen Wert ergeben"

View File

@ -128,6 +128,9 @@ msgstr "Analyse terminée"
msgid "Analyzes only organic matter"
msgstr "N'analyse que la matière organique"
msgid "Anisotropy level\\Anisotropy level"
msgstr ""
msgid "Ant"
msgstr "Fourmi"
@ -825,6 +828,9 @@ msgstr "Mini\\Qualité minimale (+ rapide)"
msgid "Lunar Roving Vehicle"
msgstr "Lunar Roving Vehicle"
msgid "MSAA\\Multisample anti-aliasing"
msgstr ""
msgid "Marks on the ground\\Marks on the ground"
msgstr "Marques sur le sol\\Marques dessinées sur le sol"
@ -834,6 +840,9 @@ msgstr "Taille maximale"
msgid "Minimize"
msgstr "Taille réduite"
msgid "Mipmap level\\Mipmap level"
msgstr ""
msgid "Mission name"
msgstr "Nom de la mission"
@ -1460,6 +1469,9 @@ msgstr "Cible"
msgid "Target bot"
msgstr "Cible d'entraînement"
msgid "Texture filtering\\Texture filtering"
msgstr ""
msgid "The expression must return a boolean value"
msgstr "L'expression doit ętre un boolean"

View File

@ -133,6 +133,9 @@ msgstr "Analiza wykonana"
msgid "Analyzes only organic matter"
msgstr "Analizuje jedynie materię organiczną"
msgid "Anisotropy level\\Anisotropy level"
msgstr ""
msgid "Ant"
msgstr "Mrówka"
@ -833,6 +836,9 @@ msgstr ""
msgid "Lunar Roving Vehicle"
msgstr "Pojazd Księżycowy"
msgid "MSAA\\Multisample anti-aliasing"
msgstr ""
msgid "Marks on the ground\\Marks on the ground"
msgstr "Znaki na ziemi\\Znaki na ziemi"
@ -842,6 +848,9 @@ msgstr "Powiększ"
msgid "Minimize"
msgstr "Pomniejsz"
msgid "Mipmap level\\Mipmap level"
msgstr ""
msgid "Mission name"
msgstr "Nazwa misji"
@ -1461,6 +1470,9 @@ msgstr "Cel"
msgid "Target bot"
msgstr "Robot cel"
msgid "Texture filtering\\Texture filtering"
msgstr ""
msgid "The expression must return a boolean value"
msgstr "Wyrażenie musi zwrócić wartość logiczną"

View File

@ -128,6 +128,9 @@ msgstr "Анализ выполнен"
msgid "Analyzes only organic matter"
msgstr "Анализирую только органические вещества"
msgid "Anisotropy level\\Anisotropy level"
msgstr ""
msgid "Ant"
msgstr "Муравей"
@ -824,6 +827,9 @@ msgstr "Низкое\\Минимальное качество графики (б
msgid "Lunar Roving Vehicle"
msgstr "Луноход"
msgid "MSAA\\Multisample anti-aliasing"
msgstr ""
msgid "Marks on the ground\\Marks on the ground"
msgstr "Метки на земле\\Метки на земле"
@ -833,6 +839,9 @@ msgstr "Развернуть"
msgid "Minimize"
msgstr "Свернуть"
msgid "Mipmap level\\Mipmap level"
msgstr ""
msgid "Mission name"
msgstr "Название миссии"
@ -1456,6 +1465,9 @@ msgstr "Цель"
msgid "Target bot"
msgstr "Целевой бот"
msgid "Texture filtering\\Texture filtering"
msgstr ""
msgid "The expression must return a boolean value"
msgstr "Выражение должно возвращать логическое значение"

View File

@ -218,6 +218,14 @@ void InitializeEventTypeTexts()
EVENT_TYPE_TEXT[EVENT_INTERFACE_EDITMODE]= "EVENT_INTERFACE_EDITMODE";
EVENT_TYPE_TEXT[EVENT_INTERFACE_EDITVALUE]= "EVENT_INTERFACE_EDITVALUE";
EVENT_TYPE_TEXT[EVENT_INTERFACE_SOLUCE4] = "EVENT_INTERFACE_SOLUCE4";
EVENT_TYPE_TEXT[EVENT_INTERFACE_BLOOD] = "EVENT_INTERFACE_BLOOD";
EVENT_TYPE_TEXT[EVENT_INTERFACE_AUTOSAVE_ENABLE] = "EVENT_INTERFACE_AUTOSAVE_ENABLE";
EVENT_TYPE_TEXT[EVENT_INTERFACE_AUTOSAVE_INTERVAL] = "EVENT_INTERFACE_AUTOSAVE_INTERVAL";
EVENT_TYPE_TEXT[EVENT_INTERFACE_AUTOSAVE_SLOTS] = "EVENT_INTERFACE_AUTOSAVE_SLOTS";
EVENT_TYPE_TEXT[EVENT_INTERFACE_TEXTURE_FILTER] = "EVENT_INTERFACE_TEXTURE_FILTER";
EVENT_TYPE_TEXT[EVENT_INTERFACE_TEXTURE_MIPMAP] = "EVENT_INTERFACE_TEXTURE_MIPMAP";
EVENT_TYPE_TEXT[EVENT_INTERFACE_TEXTURE_ANISOTROPY] = "EVENT_INTERFACE_TEXTURE_ANISOTROPY";
EVENT_TYPE_TEXT[EVENT_INTERFACE_MSAA] = "EVENT_INTERFACE_MSAA";
EVENT_TYPE_TEXT[EVENT_INTERFACE_KINFO1] = "EVENT_INTERFACE_KINFO1";
EVENT_TYPE_TEXT[EVENT_INTERFACE_KINFO2] = "EVENT_INTERFACE_KINFO2";

View File

@ -243,10 +243,10 @@ enum EventType
EVENT_INTERFACE_AUTOSAVE_ENABLE = 780,
EVENT_INTERFACE_AUTOSAVE_INTERVAL = 781,
EVENT_INTERFACE_AUTOSAVE_SLOTS = 782,
// new
EVENT_INTERFACE_TEXTURE_FILTER = 783,
EVENT_INTERFACE_TEXTURE_MIPMAP = 784,
EVENT_INTERFACE_TEXTURE_ANISOTROPY = 785,
EVENT_INTERFACE_MSAA = 786,
EVENT_INTERFACE_KINFO1 = 500,
EVENT_INTERFACE_KINFO2 = 501,

View File

@ -216,6 +216,7 @@ void InitializeRestext()
stringsEvent[EVENT_INTERFACE_TEXTURE_FILTER] = TR("Texture filtering\\Texture filtering");
stringsEvent[EVENT_INTERFACE_TEXTURE_MIPMAP] = TR("Mipmap level\\Mipmap level");
stringsEvent[EVENT_INTERFACE_TEXTURE_ANISOTROPY]= TR("Anisotropy level\\Anisotropy level");
stringsEvent[EVENT_INTERFACE_MSAA] = TR("MSAA\\Multisample anti-aliasing");
stringsEvent[EVENT_INTERFACE_KDEF] = TR("Standard controls\\Standard key functions");
assert(INPUT_SLOT_MAX < EVENT_INTERFACE_KEY_END-EVENT_INTERFACE_KEY);

View File

@ -441,6 +441,9 @@ public:
//! Returns max anisotropy level supported
virtual int GetMaxAnisotropyLevel() = 0;
//! Returns max samples supported
virtual int GetMaxSamples() = 0;
};

View File

@ -392,4 +392,9 @@ int CNullDevice::GetMaxAnisotropyLevel()
return 1;
}
int CNullDevice::GetMaxSamples()
{
return 1;
}
} // namespace Gfx

View File

@ -155,6 +155,8 @@ public:
virtual bool IsAnisotropySupported();
virtual int GetMaxAnisotropyLevel();
virtual int GetMaxSamples();
private:
Math::Matrix m_matrix;
Material m_material;

View File

@ -2584,7 +2584,12 @@ float CEngine::GetShadowRange()
void CEngine::SetMultiSample(int value)
{
bool changed = m_multisample != value;
m_multisample = value;
if(changed)
{
m_device->DeleteFramebuffer("multisample");
}
}
int CEngine::GetMultiSample()

View File

@ -46,6 +46,7 @@ CGL21Device::CGL21Device(const DeviceConfig &config)
m_lastVboId = 0;
m_anisotropyAvailable = false;
m_maxAnisotropy = 1;
m_maxSamples = 1;
m_glMajor = 1;
m_glMinor = 1;
@ -211,6 +212,17 @@ bool CGL21Device::Create()
{
GetLogger()->Info("Anisotropic filtering not available\n");
}
// Read maximum sample count for MSAA
if(glewIsSupported("GL_ARB_multisample"))
{
glGetIntegerv(GL_MAX_SAMPLES_EXT, &m_maxSamples);
GetLogger()->Info("Multisampling supported, max samples: %d\n", m_maxSamples);
}
else
{
GetLogger()->Info("Multisampling not supported\n");
}
}
// This is mostly done in all modern hardware by default
@ -1771,4 +1783,9 @@ int CGL21Device::GetMaxAnisotropyLevel()
return m_maxAnisotropy;
}
int CGL21Device::GetMaxSamples()
{
return m_maxSamples;
}
} // namespace Gfx

View File

@ -150,6 +150,8 @@ public:
virtual bool IsAnisotropySupported() override;
virtual int GetMaxAnisotropyLevel() override;
virtual int GetMaxSamples() override;
private:
//! Updates position for given light based on transformation matrices
void UpdateLightPosition(int index);
@ -221,6 +223,8 @@ private:
bool m_anisotropyAvailable;
//! Maximum anisotropy level
int m_maxAnisotropy;
//! Maximum samples
int m_maxSamples;
//! Framebuffer support
FramebufferSupport m_framebufferSupport;
//! Map of saved VBO objects

View File

@ -45,6 +45,7 @@ CGL33Device::CGL33Device(const DeviceConfig &config)
m_lastVboId = 0;
m_anisotropyAvailable = false;
m_maxAnisotropy = 1;
m_maxSamples = 1;
m_glMajor = 1;
m_glMinor = 1;
@ -217,6 +218,17 @@ bool CGL33Device::Create()
{
GetLogger()->Info("Anisotropic filtering not available\n");
}
// Read maximum sample count for MSAA
if(glewIsSupported("GL_ARB_multisample"))
{
glGetIntegerv(GL_MAX_SAMPLES_EXT, &m_maxSamples);
GetLogger()->Info("Multisampling supported, max samples: %d\n", m_maxSamples);
}
else
{
GetLogger()->Info("Multisampling not supported\n");
}
}
// Set just to be sure
@ -1964,4 +1976,9 @@ int CGL33Device::GetMaxAnisotropyLevel()
return m_maxAnisotropy;
}
int CGL33Device::GetMaxSamples()
{
return m_maxSamples;
}
} // namespace Gfx

View File

@ -149,6 +149,8 @@ public:
virtual bool IsAnisotropySupported() override;
virtual int GetMaxAnisotropyLevel() override;
virtual int GetMaxSamples() override;
private:
//! Updates position for given light based on transformation matrices
void UpdateLightPosition(int index);
@ -221,6 +223,8 @@ private:
bool m_anisotropyAvailable;
//! Maximum anisotropy level
int m_maxAnisotropy;
//! Maximum samples
int m_maxSamples;
//! Map of saved VBO objects
std::map<unsigned int, VertexBufferInfo> m_vboObjects;
//! Last ID of VBO object

View File

@ -47,6 +47,7 @@ CGLDevice::CGLDevice(const DeviceConfig &config)
m_vertexBufferType = VBT_DISPLAY_LIST;
m_anisotropyAvailable = false;
m_maxAnisotropy = 1;
m_maxSamples = 1;
m_glMajor = 1;
m_glMinor = 1;
m_shadowMappingSupport = SMS_NONE;
@ -231,6 +232,17 @@ bool CGLDevice::Create()
GetLogger()->Info("Anisotropic filtering not available\n");
}
// Read maximum sample count for MSAA
if(glewIsSupported("GL_ARB_multisample"))
{
glGetIntegerv(GL_MAX_SAMPLES_EXT, &m_maxSamples);
GetLogger()->Info("Multisampling supported, max samples: %d\n", m_maxSamples);
}
else
{
GetLogger()->Info("Multisampling not supported\n");
}
GetLogger()->Info("Auto-detecting VBO support\n");
// detecting VBO ARB extension
@ -1903,4 +1915,9 @@ int CGLDevice::GetMaxAnisotropyLevel()
return m_maxAnisotropy;
}
int CGLDevice::GetMaxSamples()
{
return m_maxSamples;
}
} // namespace Gfx

View File

@ -169,6 +169,8 @@ public:
virtual bool IsAnisotropySupported() override;
virtual int GetMaxAnisotropyLevel() override;
virtual int GetMaxSamples() override;
private:
//! Updates internal modelview matrix
void UpdateModelviewMatrix();
@ -245,6 +247,8 @@ private:
bool m_anisotropyAvailable;
//! Maximum anisotropy level
int m_maxAnisotropy;
//! Maximum samples
int m_maxSamples;
//! Framebuffer support
FramebufferSupport m_framebufferSupport;
//! Which vertex buffer type to use

View File

@ -214,6 +214,7 @@ void CMainDialog::ChangePhase(Phase phase)
CCheck* pc;
CScroll* ps;
CSlider* psl;
CEnumSlider* pes;
CButton* pb;
CColor* pco;
CGroup* pg;
@ -1090,6 +1091,25 @@ void CMainDialog::ChangePhase(Phase phase)
pc->SetState(STATE_SHADOW);
}
pos.x = ox+sx*3;
pos.y = 0.245f;
ddim.x = dim.x*2.2f;
ddim.y = 18.0f/480.0f;
pes = pw->CreateEnumSlider(pos, ddim, 0, EVENT_INTERFACE_MSAA);
pes->SetState(STATE_SHADOW);
std::vector<float> msaaOptions;
for(int i = 1; i <= m_engine->GetDevice()->GetMaxSamples(); i *= 2)
msaaOptions.push_back(i);
pes->SetPossibleValues(msaaOptions);
if(m_engine->GetDevice()->GetMaxSamples() < 2)
pes->ClearState(STATE_ENABLE);
pos.y += ddim.y/2;
pos.x += 0.005f;
ddim.x = 0.40f;
GetResource(RES_EVENT, EVENT_INTERFACE_MSAA, name);
pl = pw->CreateLabel(pos, ddim, 0, EVENT_LABEL12, name);
pl->SetTextAlign(Gfx::TEXT_ALIGN_LEFT);
pos.x = ox+sx*8.5f;
pos.y = 0.65f;
ddim.x = dim.x*2.2f;
@ -1153,8 +1173,6 @@ void CMainDialog::ChangePhase(Phase phase)
pl->SetTextAlign(Gfx::TEXT_ALIGN_LEFT);
}
CEnumSlider* pes;
pos.x = ox+sx*8.5f;
pos.y = 0.385f;
ddim.x = dim.x*2.2f;
@ -2465,6 +2483,7 @@ bool CMainDialog::EventProcess(const Event &event)
case EVENT_INTERFACE_TEXTURE_FILTER:
case EVENT_INTERFACE_TEXTURE_MIPMAP:
case EVENT_INTERFACE_TEXTURE_ANISOTROPY:
case EVENT_INTERFACE_MSAA:
ChangeSetupButtons();
UpdateSetupButtons();
break;
@ -4668,6 +4687,12 @@ void CMainDialog::UpdateSetupButtons()
pes->SetVisibleValue(m_engine->GetTextureAnisotropyLevel());
}
pes = static_cast<CEnumSlider*>(pw->SearchControl(EVENT_INTERFACE_MSAA));
if ( pes != 0 )
{
pes->SetVisibleValue(m_engine->GetMultiSample());
}
pc = static_cast<CCheck*>(pw->SearchControl(EVENT_INTERFACE_SHADOW));
if ( pc != 0 )
{
@ -4855,6 +4880,13 @@ void CMainDialog::ChangeSetupButtons()
value = pes->GetVisibleValue();
m_engine->SetTextureAnisotropyLevel(static_cast<int>(value));
}
pes = static_cast<CEnumSlider*>(pw->SearchControl(EVENT_INTERFACE_MSAA));
if ( pes != 0 )
{
value = pes->GetVisibleValue();
m_engine->SetMultiSample(static_cast<int>(value));
}
}