Update scenewidget when antialiasing settings change.

deque
cc9cii 10 years ago
parent 8a0ff17c22
commit 303b0ee8c6

@ -192,6 +192,17 @@ void CSMSettings::UserSettings::buildSettingModelDefaults()
ritd->setEditorSetting (true); ritd->setEditorSetting (true);
} }
section = "Video";
{
QString defaultValue = "None";
QStringList values = QStringList()
<< defaultValue << "MSAA 2" << "MSAA 4" << "MSAA 8" << "MSAA 16";
Setting *antialiasing = createSetting (Type_SpinBox, section, "antialiasing");
antialiasing->setDeclaredValues (values);
antialiasing->setEditorSetting (true);
antialiasing->setWidgetWidth(15);
}
section = "Proxy Selection Test"; section = "Proxy Selection Test";
{ {
/****************************************************************** /******************************************************************
@ -483,7 +494,7 @@ void CSMSettings::UserSettings::updateUserSetting(const QString &settingKey,
sh::Factory::getInstance ().setShadersEnabled (list.at(0) == "true" ? true : false); sh::Factory::getInstance ().setShadersEnabled (list.at(0) == "true" ? true : false);
} }
emit userSettingUpdated (settingKey, list); // TODO: isn't this circular? emit userSettingUpdated (settingKey, list);
} }
CSMSettings::Setting *CSMSettings::UserSettings::findSetting CSMSettings::Setting *CSMSettings::UserSettings::findSetting

@ -128,7 +128,16 @@ namespace CSVRender
params.insert(std::make_pair("externalWindowHandle", windowHandle.str())); params.insert(std::make_pair("externalWindowHandle", windowHandle.str()));
params.insert(std::make_pair("title", windowTitle.str())); params.insert(std::make_pair("title", windowTitle.str()));
params.insert(std::make_pair("FSAA", "0")); // TODO setting
std::string antialiasing =
CSMSettings::UserSettings::instance().settingValue("Video/antialiasing").toStdString();
if(antialiasing == "MSAA 16") antialiasing = "16";
else if(antialiasing == "MSAA 8") antialiasing = "8";
else if(antialiasing == "MSAA 4") antialiasing = "4";
else if(antialiasing == "MSAA 2") antialiasing = "2";
else antialiasing = "0";
params.insert(std::make_pair("FSAA", antialiasing));
params.insert(std::make_pair("vsync", "false")); // TODO setting params.insert(std::make_pair("vsync", "false")); // TODO setting
#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE #if OGRE_PLATFORM == OGRE_PLATFORM_APPLE
params.insert(std::make_pair("macAPI", "cocoa")); params.insert(std::make_pair("macAPI", "cocoa"));
@ -402,5 +411,38 @@ namespace CSVRender
{ {
if(key.contains(QRegExp("^\\b(Objects|Shader|Scene)", Qt::CaseInsensitive))) if(key.contains(QRegExp("^\\b(Objects|Shader|Scene)", Qt::CaseInsensitive)))
flagAsModified(); flagAsModified();
// minimise unnecessary ogre window creation by updating only when there is a change
if(key == "Video/antialiasing")
{
std::string result;
Ogre::ConfigOptionMap& renderOpt =
Ogre::Root::getSingleton().getRenderSystem()->getConfigOptions();
Ogre::ConfigOptionMap::iterator it = renderOpt.begin();
for(; it != renderOpt.end(); ++it)
{
if(it->first == "FSAA")
result = it->second.currentValue;
}
QString antialiasing = "0";
if(!list.empty())
{
antialiasing = list.at(0);
if(antialiasing == "MSAA 16") antialiasing = "16";
else if(antialiasing == "MSAA 8") antialiasing = "8";
else if(antialiasing == "MSAA 4") antialiasing = "4";
else if(antialiasing == "MSAA 2") antialiasing = "2";
}
if(result != antialiasing.toStdString())
{
updateOgreWindow();
}
}
} }
} }

@ -129,8 +129,8 @@ void CSVSettings::RangeView::buildSpinBox (CSMSettings::Setting *setting)
mRangeWidget->setProperty ("wrapping", setting->wrapping()); mRangeWidget->setProperty ("wrapping", setting->wrapping());
dynamic_cast<QAbstractSpinBox *> (mRangeWidget)->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); dynamic_cast<QAbstractSpinBox *> (mRangeWidget)->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
if(setting->type() == CSMSettings::Type_SpinBox) if(setting->type() == CSMSettings::Type_SpinBox && setting->declaredValues().isEmpty())
dynamic_cast<QSpinBox *> (mRangeWidget)->setValue (setting->defaultValues().at(0).toInt()); // FIXME: can there be more than one? dynamic_cast<QSpinBox *> (mRangeWidget)->setValue (setting->defaultValues().at(0).toInt());
} }
void CSVSettings::RangeView::slotUpdateView (int value) void CSVSettings::RangeView::slotUpdateView (int value)

Loading…
Cancel
Save