This commit is contained in:
Bruno Rybársky 2023-11-04 14:14:07 +01:00
parent fbec168e91
commit 53f570e699
8 changed files with 20 additions and 9 deletions

3
.gitignore vendored

@ -121,8 +121,5 @@ compile_commands.json
*.sln
.vs/
# Optional user provided library folder
lib/irrlichtmt
# Generated mod storage database
client/mod_storage.sqlite

3
.gitmodules vendored Normal file

@ -0,0 +1,3 @@
[submodule "lib/irrlichtmt"]
path = lib/irrlichtmt
url = git@brn.systems:BRNSystems/irrlicht.git

@ -256,6 +256,10 @@ connected_glass (Connect glass) bool false
# Disable for speed or for different looks.
smooth_lighting (Smooth lighting) bool true
# Enable full brightness for great visibility in the dark
# Disable if you think this is cheating
full_brightness (Full brightness) bool false
# Enables tradeoffs that reduce CPU load or increase rendering performance
# at the expense of minor visual glitches that do not impact game playability.
performance_tradeoffs (Tradeoffs for performance) bool false

@ -7,12 +7,6 @@ if(DEVELOPMENT_BUILD)
ERROR_QUIET)
if(VERSION_GITHASH)
set(VERSION_GITHASH "${VERSION_STRING}-${VERSION_GITHASH}")
execute_process(COMMAND git diff-index --quiet HEAD
WORKING_DIRECTORY "${GENERATE_VERSION_SOURCE_DIR}"
RESULT_VARIABLE IS_DIRTY)
if(IS_DIRTY)
set(VERSION_GITHASH "${VERSION_GITHASH}-dirty")
endif()
message(STATUS "*** Detected Git version ${VERSION_GITHASH} ***")
endif()
endif()

1
lib/irrlichtmt Submodule

@ -0,0 +1 @@
Subproject commit 85081d6fe0c422cf47f74714ee25562715528aa2

@ -187,6 +187,11 @@
# type: bool
# smooth_lighting = true
# Enable full brightness for great visibility in the dark
# Disable if you think this is cheating
# type: bool
full_brightness (Full brightness) bool false
# Enables tradeoffs that reduce CPU load or increase rendering performance
# at the expense of minor visual glitches that do not impact game playability.
# type: bool

@ -198,6 +198,7 @@ void set_default_settings()
settings->setDefault("leaves_style", "fancy");
settings->setDefault("connected_glass", "false");
settings->setDefault("smooth_lighting", "true");
settings->setDefault("full_brightness", "false");
settings->setDefault("performance_tradeoffs", "false");
settings->setDefault("lighting_alpha", "0.0");
settings->setDefault("lighting_beta", "1.5");

@ -35,6 +35,7 @@ struct LightingParams {
float a, b, c; // Lighting curve polynomial coefficients
float boost, center, sigma; // Lighting curve parametric boost
float gamma; // Lighting curve gamma correction
bool full_brightness; //Full brightness
};
static LightingParams params;
@ -42,6 +43,9 @@ static LightingParams params;
float decode_light_f(float x)
{
if (params.full_brightness){
return 1.0f;
}
if (x >= 1.0f) // x is often 1.0f
return 1.0f;
x = std::fmax(x, 0.0f);
@ -62,6 +66,8 @@ void set_light_table(float gamma)
// Lighting curve bounding gradients
const float alpha = rangelim(g_settings->getFloat("lighting_alpha"), 0.0f, 3.0f);
const float beta = rangelim(g_settings->getFloat("lighting_beta"), 0.0f, 3.0f);
const bool full_brightness = g_settings->getBool("full_brightness");
params.full_brightness = full_brightness;
// Lighting curve polynomial coefficients
params.a = alpha + beta - 2.0f;
params.b = 3.0f - 2.0f * alpha - beta;