Rename WaterUgly setting to WaterEffects in order to remove the invertedboolean workaround of the options page.

Differential Revision: https://code.wildfiregames.com/D815
Refs #3737
Tested By: Stan
This was SVN commit r20010.
This commit is contained in:
elexis 2017-08-21 00:09:25 +00:00
parent abbdd391b5
commit 04f2209b50
14 changed files with 44 additions and 50 deletions

View File

@ -61,7 +61,7 @@ macmouse = false
; if false, actors won't be rendered but anything entity will be. ; if false, actors won't be rendered but anything entity will be.
renderactors = true renderactors = true
waterugly=false; Force usage of the fixed pipeline water. This is faster, but really, really ugly. watereffects=true ; When disabled, force usage of the fixed pipeline water. This is faster, but really, really ugly.
waterfancyeffects = false waterfancyeffects = false
waterrealdepth = true waterrealdepth = true
waterrefraction = true waterrefraction = true

View File

@ -74,7 +74,6 @@ function setupControl(option, i, category)
switch (option.type) switch (option.type)
{ {
case "boolean": case "boolean":
case "invertedboolean":
// More space for the label // More space for the label
let text = Engine.GetGUIObjectByName(category + "Label[" + i + "]"); let text = Engine.GetGUIObjectByName(category + "Label[" + i + "]");
let size = text.size; let size = text.size;
@ -109,23 +108,18 @@ function setupControl(option, i, category)
warn("Unknown option source type '" + param + "'"); warn("Unknown option source type '" + param + "'");
} }
} }
// invertedboolean when we want to display the opposite of the flag value
var inverted = option.type === "invertedboolean";
if (inverted)
checked = !checked;
onUpdate = function(key, keyRenderer, inverted) onUpdate = function(key, keyRenderer)
{ {
return function() return function()
{ {
let val = inverted ? !this.checked : this.checked;
if (keyRenderer) if (keyRenderer)
Engine["Renderer_Set" + keyRenderer + "Enabled"](val); Engine["Renderer_Set" + keyRenderer + "Enabled"](this.checked);
Engine.ConfigDB_CreateValue("user", key, String(val)); Engine.ConfigDB_CreateValue("user", key, String(this.checked));
Engine.ConfigDB_SetChanges("user", true); Engine.ConfigDB_SetChanges("user", true);
updateOptionPanel(); updateOptionPanel();
}; };
}(key, keyRenderer, inverted); }(key, keyRenderer);
// Load final data to the control element. // Load final data to the control element.
control.checked = checked; control.checked = checked;
@ -299,7 +293,7 @@ function updateOptionPanel()
for (let item in g_Controls) for (let item in g_Controls)
{ {
let control = g_Controls[item]; let control = g_Controls[item];
if (control.type !== "boolean" && control.type !== "invertedboolean" || !control.dependencies) if (control.type != "boolean" || !control.dependencies)
continue; continue;
for (let dependency of control.dependencies) for (let dependency of control.dependencies)
@ -354,7 +348,7 @@ function revertChanges()
// needs to update renderer values (which are all of boolean type) // needs to update renderer values (which are all of boolean type)
if (control.parameters.renderer) if (control.parameters.renderer)
{ {
if (control.type !== "boolean" && control.type !== "invertedboolean") if (control.type != "boolean")
{ {
warn("Invalid type option " + control.type + " defined in renderer for " + item + ": will not be reverted"); warn("Invalid type option " + control.type + " defined in renderer for " + item + ": will not be reverted");
continue; continue;

View File

@ -197,10 +197,10 @@
"parameters": { "config": "particles", "renderer": "Particles" } "parameters": { "config": "particles", "renderer": "Particles" }
}, },
{ {
"type": "invertedboolean", "type": "boolean",
"label": "Water Effects", "label": "Water Effects",
"tooltip": "When OFF, use the lowest settings possible to render water. This makes other settings irrelevant.", "tooltip": "When OFF, use the lowest settings possible to render water. This makes other settings irrelevant.",
"parameters": { "config": "waterugly", "renderer": "WaterUgly" }, "parameters": { "config": "watereffects", "renderer": "WaterEffects" },
"dependencies": [ "waterfancyeffects", "waterrealdepth", "waterreflection", "waterrefraction", "watershadows" ] "dependencies": [ "waterfancyeffects", "waterrealdepth", "waterreflection", "waterrefraction", "watershadows" ]
}, },
{ {

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2016 Wildfire Games. /* Copyright (C) 2017 Wildfire Games.
* This file is part of 0 A.D. * This file is part of 0 A.D.
* *
* 0 A.D. is free software: you can redistribute it and/or modify * 0 A.D. is free software: you can redistribute it and/or modify
@ -42,7 +42,7 @@ bool g_RenderActors = true;
bool g_Shadows = false; bool g_Shadows = false;
bool g_ShadowPCF = false; bool g_ShadowPCF = false;
bool g_WaterUgly = false; bool g_WaterEffects = true;
bool g_WaterFancyEffects = false; bool g_WaterFancyEffects = false;
bool g_WaterRealDepth = false; bool g_WaterRealDepth = false;
bool g_WaterRefraction = false; bool g_WaterRefraction = false;
@ -96,7 +96,7 @@ static void LoadGlobals()
CFG_GET_VAL("shadows", g_Shadows); CFG_GET_VAL("shadows", g_Shadows);
CFG_GET_VAL("shadowpcf", g_ShadowPCF); CFG_GET_VAL("shadowpcf", g_ShadowPCF);
CFG_GET_VAL("waterugly", g_WaterUgly); CFG_GET_VAL("watereffects", g_WaterEffects);
CFG_GET_VAL("waterfancyeffects", g_WaterFancyEffects); CFG_GET_VAL("waterfancyeffects", g_WaterFancyEffects);
CFG_GET_VAL("waterrealdepth", g_WaterRealDepth); CFG_GET_VAL("waterrealdepth", g_WaterRealDepth);
CFG_GET_VAL("waterrefraction", g_WaterRefraction); CFG_GET_VAL("waterrefraction", g_WaterRefraction);

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2016 Wildfire Games. /* Copyright (C) 2017 Wildfire Games.
* This file is part of 0 A.D. * This file is part of 0 A.D.
* *
* 0 A.D. is free software: you can redistribute it and/or modify * 0 A.D. is free software: you can redistribute it and/or modify
@ -50,8 +50,8 @@ extern bool g_RenderActors;
// flag to switch on shadows // flag to switch on shadows
extern bool g_Shadows; extern bool g_Shadows;
// Force the use of the fixed function for rendering water. // If disabled, force the use of the fixed function for rendering water.
extern bool g_WaterUgly; extern bool g_WaterEffects;
// Add foam and waves near the shores, trails following ships, and other HQ things. // Add foam and waves near the shores, trails following ships, and other HQ things.
extern bool g_WaterFancyEffects; extern bool g_WaterFancyEffects;
// Use real depth for water rendering. // Use real depth for water rendering.

View File

@ -614,8 +614,8 @@ static void InitRenderer()
g_Renderer.SetOptionBool(CRenderer::OPT_SHADOWS, g_Shadows); g_Renderer.SetOptionBool(CRenderer::OPT_SHADOWS, g_Shadows);
g_ConfigDB.SetValueBool(CFG_SYSTEM, "shadows", g_Shadows); g_ConfigDB.SetValueBool(CFG_SYSTEM, "shadows", g_Shadows);
g_Renderer.SetOptionBool(CRenderer::OPT_WATERUGLY, g_WaterUgly); g_Renderer.SetOptionBool(CRenderer::OPT_WATEREFFECTS, g_WaterEffects);
g_ConfigDB.SetValueBool(CFG_SYSTEM, "waterugly", g_WaterUgly); g_ConfigDB.SetValueBool(CFG_SYSTEM, "watereffects", g_WaterEffects);
g_Renderer.SetOptionBool(CRenderer::OPT_WATERFANCYEFFECTS, g_WaterFancyEffects); g_Renderer.SetOptionBool(CRenderer::OPT_WATERFANCYEFFECTS, g_WaterFancyEffects);
g_ConfigDB.SetValueBool(CFG_SYSTEM, "waterfancyeffects", g_WaterFancyEffects); g_ConfigDB.SetValueBool(CFG_SYSTEM, "waterfancyeffects", g_WaterFancyEffects);
g_Renderer.SetOptionBool(CRenderer::OPT_WATERREALDEPTH, g_WaterRealDepth); g_Renderer.SetOptionBool(CRenderer::OPT_WATERREALDEPTH, g_WaterRealDepth);

View File

@ -150,8 +150,8 @@ void SetDisableShadowPCF(ScriptInterface::CxPrivate* UNUSED(pCxPrivate), bool di
void SetDisableAllWater(ScriptInterface::CxPrivate* UNUSED(pCxPrivate), bool disabled) void SetDisableAllWater(ScriptInterface::CxPrivate* UNUSED(pCxPrivate), bool disabled)
{ {
if (!IsOverridden("waterugly")) if (!IsOverridden("watereffects"))
g_WaterUgly = disabled; g_WaterEffects = !disabled;
if (!IsOverridden("waterfancyeffects")) if (!IsOverridden("waterfancyeffects"))
g_WaterFancyEffects = !disabled; g_WaterFancyEffects = !disabled;
if (!IsOverridden("waterrealdepth")) if (!IsOverridden("waterrealdepth"))

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2013 Wildfire Games. /* Copyright (C) 2017 Wildfire Games.
* This file is part of 0 A.D. * This file is part of 0 A.D.
* *
* 0 A.D. is free software: you can redistribute it and/or modify * 0 A.D. is free software: you can redistribute it and/or modify
@ -1485,7 +1485,10 @@ void CPatchRData::RenderWater(CShaderProgramPtr& shader, bool onlyShore, bool fi
g_Renderer.m_Stats.m_DrawCalls++; g_Renderer.m_Stats.m_DrawCalls++;
g_Renderer.m_Stats.m_WaterTris += m_VBWaterIndices->m_Count / 3; g_Renderer.m_Stats.m_WaterTris += m_VBWaterIndices->m_Count / 3;
} }
if (m_VBWaterShore != 0x0 && g_Renderer.GetWaterManager()->m_WaterFancyEffects && !g_Renderer.GetWaterManager()->m_WaterUgly)
if (m_VBWaterShore != 0x0 &&
g_Renderer.GetWaterManager()->m_WaterEffects &&
g_Renderer.GetWaterManager()->m_WaterFancyEffects)
{ {
SWaterVertex *base=(SWaterVertex *)m_VBWaterShore->m_Owner->Bind(); SWaterVertex *base=(SWaterVertex *)m_VBWaterShore->m_Owner->Bind();

View File

@ -430,7 +430,7 @@ CRenderer::CRenderer()
m_Options.m_NoVBO = false; m_Options.m_NoVBO = false;
m_Options.m_RenderPath = RP_DEFAULT; m_Options.m_RenderPath = RP_DEFAULT;
m_Options.m_Shadows = false; m_Options.m_Shadows = false;
m_Options.m_WaterUgly = true; m_Options.m_WaterEffects = false;
m_Options.m_WaterFancyEffects = false; m_Options.m_WaterFancyEffects = false;
m_Options.m_WaterRealDepth = false; m_Options.m_WaterRealDepth = false;
m_Options.m_WaterRefraction = false; m_Options.m_WaterRefraction = false;
@ -691,8 +691,8 @@ void CRenderer::SetOptionBool(enum Option opt,bool value)
m_Options.m_Shadows = value; m_Options.m_Shadows = value;
MakeShadersDirty(); MakeShadersDirty();
break; break;
case OPT_WATERUGLY: case OPT_WATEREFFECTS:
m_Options.m_WaterUgly = value; m_Options.m_WaterEffects = value;
break; break;
case OPT_WATERFANCYEFFECTS: case OPT_WATERFANCYEFFECTS:
m_Options.m_WaterFancyEffects = value; m_Options.m_WaterFancyEffects = value;
@ -751,8 +751,8 @@ bool CRenderer::GetOptionBool(enum Option opt) const
return m_Options.m_NoVBO; return m_Options.m_NoVBO;
case OPT_SHADOWS: case OPT_SHADOWS:
return m_Options.m_Shadows; return m_Options.m_Shadows;
case OPT_WATERUGLY: case OPT_WATEREFFECTS:
return m_Options.m_WaterUgly; return m_Options.m_WaterEffects;
case OPT_WATERFANCYEFFECTS: case OPT_WATERFANCYEFFECTS:
return m_Options.m_WaterFancyEffects; return m_Options.m_WaterFancyEffects;
case OPT_WATERREALDEPTH: case OPT_WATERREALDEPTH:

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2016 Wildfire Games. /* Copyright (C) 2017 Wildfire Games.
* This file is part of 0 A.D. * This file is part of 0 A.D.
* *
* 0 A.D. is free software: you can redistribute it and/or modify * 0 A.D. is free software: you can redistribute it and/or modify
@ -75,7 +75,7 @@ public:
enum Option { enum Option {
OPT_NOVBO, OPT_NOVBO,
OPT_SHADOWS, OPT_SHADOWS,
OPT_WATERUGLY, OPT_WATEREFFECTS,
OPT_WATERFANCYEFFECTS, OPT_WATERFANCYEFFECTS,
OPT_WATERREALDEPTH, OPT_WATERREALDEPTH,
OPT_WATERREFLECTION, OPT_WATERREFLECTION,
@ -138,7 +138,7 @@ public:
bool m_NoVBO; bool m_NoVBO;
bool m_Shadows; bool m_Shadows;
bool m_WaterUgly; bool m_WaterEffects;
bool m_WaterFancyEffects; bool m_WaterFancyEffects;
bool m_WaterRealDepth; bool m_WaterRealDepth;
bool m_WaterRefraction; bool m_WaterRefraction;

View File

@ -112,7 +112,7 @@ WaterManager::WaterManager()
m_ShoreWaves_VBIndices = NULL; m_ShoreWaves_VBIndices = NULL;
m_WaterUgly = false; m_WaterEffects = true;
m_WaterFancyEffects = false; m_WaterFancyEffects = false;
m_WaterRealDepth = false; m_WaterRealDepth = false;
m_WaterRefraction = false; m_WaterRefraction = false;
@ -1119,8 +1119,9 @@ void WaterManager::SetMapSize(size_t size)
// This will set the bools properly // This will set the bools properly
void WaterManager::UpdateQuality() void WaterManager::UpdateQuality()
{ {
if (g_Renderer.GetOptionBool(CRenderer::OPT_WATERUGLY) != m_WaterUgly) { if (g_Renderer.GetOptionBool(CRenderer::OPT_WATEREFFECTS) != m_WaterEffects)
m_WaterUgly = g_Renderer.GetOptionBool(CRenderer::OPT_WATERUGLY); {
m_WaterEffects = g_Renderer.GetOptionBool(CRenderer::OPT_WATEREFFECTS);
m_NeedsReloading = true; m_NeedsReloading = true;
} }
if (g_Renderer.GetOptionBool(CRenderer::OPT_WATERFANCYEFFECTS) != m_WaterFancyEffects) { if (g_Renderer.GetOptionBool(CRenderer::OPT_WATERFANCYEFFECTS) != m_WaterFancyEffects) {
@ -1147,9 +1148,5 @@ void WaterManager::UpdateQuality()
bool WaterManager::WillRenderFancyWater() bool WaterManager::WillRenderFancyWater()
{ {
if (!g_Renderer.GetCapabilities().m_PrettyWater) return m_RenderWater && m_WaterEffects && g_Renderer.GetCapabilities().m_PrettyWater;
return false;
if (!m_RenderWater || m_WaterUgly)
return false;
return true;
} }

View File

@ -77,8 +77,8 @@ public:
int m_WaterCurrentTex; int m_WaterCurrentTex;
bool m_RenderWater; bool m_RenderWater;
// Force the use of the fixed function for rendering. // If disabled, force the use of the fixed function for rendering.
bool m_WaterUgly; bool m_WaterEffects;
// Those variables register the current quality level. If there is a change, I have to recompile the shader. // Those variables register the current quality level. If there is a change, I have to recompile the shader.
// Use real depth or use the fake precomputed one. // Use real depth or use the fake precomputed one.
bool m_WaterRealDepth; bool m_WaterRealDepth;

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2014 Wildfire Games. /* Copyright (C) 2017 Wildfire Games.
* This file is part of 0 A.D. * This file is part of 0 A.D.
* *
* 0 A.D. is free software: you can redistribute it and/or modify * 0 A.D. is free software: you can redistribute it and/or modify
@ -34,7 +34,7 @@ void JSI_Renderer::Set##SCRIPTNAME##Enabled(ScriptInterface::CxPrivate* UNUSED(p
IMPLEMENT_BOOLEAN_SCRIPT_SETTING(PARTICLES, Particles); IMPLEMENT_BOOLEAN_SCRIPT_SETTING(PARTICLES, Particles);
IMPLEMENT_BOOLEAN_SCRIPT_SETTING(PREFERGLSL, PreferGLSL); IMPLEMENT_BOOLEAN_SCRIPT_SETTING(PREFERGLSL, PreferGLSL);
IMPLEMENT_BOOLEAN_SCRIPT_SETTING(WATERUGLY, WaterUgly); IMPLEMENT_BOOLEAN_SCRIPT_SETTING(WATEREFFECTS, WaterEffects);
IMPLEMENT_BOOLEAN_SCRIPT_SETTING(WATERFANCYEFFECTS, WaterFancyEffects); IMPLEMENT_BOOLEAN_SCRIPT_SETTING(WATERFANCYEFFECTS, WaterFancyEffects);
IMPLEMENT_BOOLEAN_SCRIPT_SETTING(SHADOWPCF, ShadowPCF); IMPLEMENT_BOOLEAN_SCRIPT_SETTING(SHADOWPCF, ShadowPCF);
IMPLEMENT_BOOLEAN_SCRIPT_SETTING(SHADOWS, Shadows); IMPLEMENT_BOOLEAN_SCRIPT_SETTING(SHADOWS, Shadows);
@ -73,7 +73,7 @@ void JSI_Renderer::RegisterScriptFunctions(ScriptInterface& scriptInterface)
REGISTER_BOOLEAN_SCRIPT_SETTING(ShadowPCF); REGISTER_BOOLEAN_SCRIPT_SETTING(ShadowPCF);
REGISTER_BOOLEAN_SCRIPT_SETTING(Particles); REGISTER_BOOLEAN_SCRIPT_SETTING(Particles);
REGISTER_BOOLEAN_SCRIPT_SETTING(PreferGLSL); REGISTER_BOOLEAN_SCRIPT_SETTING(PreferGLSL);
REGISTER_BOOLEAN_SCRIPT_SETTING(WaterUgly); REGISTER_BOOLEAN_SCRIPT_SETTING(WaterEffects);
REGISTER_BOOLEAN_SCRIPT_SETTING(WaterFancyEffects); REGISTER_BOOLEAN_SCRIPT_SETTING(WaterFancyEffects);
REGISTER_BOOLEAN_SCRIPT_SETTING(WaterRealDepth); REGISTER_BOOLEAN_SCRIPT_SETTING(WaterRealDepth);
REGISTER_BOOLEAN_SCRIPT_SETTING(WaterReflection); REGISTER_BOOLEAN_SCRIPT_SETTING(WaterReflection);

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2014 Wildfire Games. /* Copyright (C) 2017 Wildfire Games.
* This file is part of 0 A.D. * This file is part of 0 A.D.
* *
* 0 A.D. is free software: you can redistribute it and/or modify * 0 A.D. is free software: you can redistribute it and/or modify
@ -34,7 +34,7 @@ namespace JSI_Renderer
DECLARE_BOOLEAN_SCRIPT_SETTING(ShadowPCF); DECLARE_BOOLEAN_SCRIPT_SETTING(ShadowPCF);
DECLARE_BOOLEAN_SCRIPT_SETTING(Particles); DECLARE_BOOLEAN_SCRIPT_SETTING(Particles);
DECLARE_BOOLEAN_SCRIPT_SETTING(PreferGLSL); DECLARE_BOOLEAN_SCRIPT_SETTING(PreferGLSL);
DECLARE_BOOLEAN_SCRIPT_SETTING(WaterUgly); DECLARE_BOOLEAN_SCRIPT_SETTING(WaterEffects);
DECLARE_BOOLEAN_SCRIPT_SETTING(WaterFancyEffects); DECLARE_BOOLEAN_SCRIPT_SETTING(WaterFancyEffects);
DECLARE_BOOLEAN_SCRIPT_SETTING(WaterRealDepth); DECLARE_BOOLEAN_SCRIPT_SETTING(WaterRealDepth);
DECLARE_BOOLEAN_SCRIPT_SETTING(WaterReflection); DECLARE_BOOLEAN_SCRIPT_SETTING(WaterReflection);