mirror of
https://github.com/minetest/minetest.git
synced 2024-11-23 08:03:45 +01:00
Add setting to disable direction dependent fog and sky colors
This commit is contained in:
parent
848f80b2e5
commit
c120ea57c9
@ -22,16 +22,15 @@
|
|||||||
# Client and server
|
# Client and server
|
||||||
#
|
#
|
||||||
|
|
||||||
|
|
||||||
# Name of player; on a server this is the main admin
|
# Name of player; on a server this is the main admin
|
||||||
#name =
|
#name =
|
||||||
|
|
||||||
#
|
#
|
||||||
# Client stuff
|
# Client stuff
|
||||||
#
|
#
|
||||||
|
|
||||||
# Port to connect to (UDP)
|
# Port to connect to (UDP)
|
||||||
#remote_port =
|
#remote_port =
|
||||||
# Key mappings
|
# Key mappings
|
||||||
# See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3
|
# See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3
|
||||||
#keymap_forward = KEY_KEY_W
|
#keymap_forward = KEY_KEY_W
|
||||||
@ -83,7 +82,7 @@
|
|||||||
#vsync = false
|
#vsync = false
|
||||||
#fov = 72
|
#fov = 72
|
||||||
# Address to connect to (#blank = start local server)
|
# Address to connect to (#blank = start local server)
|
||||||
#address =
|
#address =
|
||||||
# Enable random user input, for testing
|
# Enable random user input, for testing
|
||||||
#random_input = false
|
#random_input = false
|
||||||
# Timeout for client to remove unused map data from memory
|
# Timeout for client to remove unused map data from memory
|
||||||
@ -116,7 +115,7 @@
|
|||||||
# disable for speed or for different looks.
|
# disable for speed or for different looks.
|
||||||
#smooth_lighting = true
|
#smooth_lighting = true
|
||||||
# Path to texture directory. All textures are first searched from here.
|
# Path to texture directory. All textures are first searched from here.
|
||||||
#texture_path =
|
#texture_path =
|
||||||
# Video back-end.
|
# Video back-end.
|
||||||
# Possible values: null, software, burningsvideo, direct3d8, direct3d9, opengl
|
# Possible values: null, software, burningsvideo, direct3d8, direct3d9, opengl
|
||||||
#video_driver = opengl
|
#video_driver = opengl
|
||||||
@ -190,6 +189,8 @@
|
|||||||
# The time in seconds it takes between repeated
|
# The time in seconds it takes between repeated
|
||||||
# right clicks when holding the right mouse button
|
# right clicks when holding the right mouse button
|
||||||
#repeat_rightclick_time = 0.25
|
#repeat_rightclick_time = 0.25
|
||||||
|
# Make fog and sky colors depend on daytime (dawn/sunset) and view direction
|
||||||
|
#directional_colored_fog = true
|
||||||
|
|
||||||
# Default timeout for cURL, in milliseconds
|
# Default timeout for cURL, in milliseconds
|
||||||
# Only has an effect if compiled with cURL
|
# Only has an effect if compiled with cURL
|
||||||
@ -228,7 +229,7 @@
|
|||||||
# Server stuff
|
# Server stuff
|
||||||
#
|
#
|
||||||
# Network port to listen (UDP)
|
# Network port to listen (UDP)
|
||||||
#port =
|
#port =
|
||||||
# Name of server
|
# Name of server
|
||||||
#server_name = Minetest server
|
#server_name = Minetest server
|
||||||
# Description of server
|
# Description of server
|
||||||
@ -262,7 +263,7 @@
|
|||||||
# Gives some stuff to players at the beginning
|
# Gives some stuff to players at the beginning
|
||||||
#give_initial_stuff = false
|
#give_initial_stuff = false
|
||||||
# New users need to input this password
|
# New users need to input this password
|
||||||
#default_password =
|
#default_password =
|
||||||
# Available privileges: interact, shout, teleport, settime, privs, ...
|
# Available privileges: interact, shout, teleport, settime, privs, ...
|
||||||
# See /privs in game for a full list on your server and mod configuration.
|
# See /privs in game for a full list on your server and mod configuration.
|
||||||
#default_privs = interact, shout
|
#default_privs = interact, shout
|
||||||
@ -278,7 +279,7 @@
|
|||||||
#disable_anticheat = false
|
#disable_anticheat = false
|
||||||
# If true, actions are recorded for rollback
|
# If true, actions are recorded for rollback
|
||||||
#enable_rollback_recording = false
|
#enable_rollback_recording = false
|
||||||
# If true, blocks are cached (and generated if not before) before a player is spawned.
|
# If true, blocks are cached (and generated if not before) before a player is spawned.
|
||||||
#cache_block_before_spawn = true
|
#cache_block_before_spawn = true
|
||||||
# Defines the maximum height a player can spawn in a map, above water level
|
# Defines the maximum height a player can spawn in a map, above water level
|
||||||
#max_spawn_height = 50
|
#max_spawn_height = 50
|
||||||
@ -342,7 +343,7 @@
|
|||||||
#emergequeue_limit_diskonly =
|
#emergequeue_limit_diskonly =
|
||||||
# Maximum number of blocks to be queued that are to be generated.
|
# Maximum number of blocks to be queued that are to be generated.
|
||||||
# Leave blank for an appropriate amount to be chosen automatically.
|
# Leave blank for an appropriate amount to be chosen automatically.
|
||||||
#emergequeue_limit_generate =
|
#emergequeue_limit_generate =
|
||||||
# Number of emerge threads to use. Make this field blank, or increase this number, to use multiple threads.
|
# Number of emerge threads to use. Make this field blank, or increase this number, to use multiple threads.
|
||||||
# On multiprocessor systems, this will improve mapgen speed greatly, at the cost of slightly buggy caves.
|
# On multiprocessor systems, this will improve mapgen speed greatly, at the cost of slightly buggy caves.
|
||||||
#num_emerge_threads = 1
|
#num_emerge_threads = 1
|
||||||
|
@ -59,6 +59,7 @@ void set_default_settings(Settings *settings)
|
|||||||
settings->setDefault("aux1_descends", "false");
|
settings->setDefault("aux1_descends", "false");
|
||||||
settings->setDefault("doubletap_jump", "false");
|
settings->setDefault("doubletap_jump", "false");
|
||||||
settings->setDefault("always_fly_fast", "true");
|
settings->setDefault("always_fly_fast", "true");
|
||||||
|
settings->setDefault("directional_colored_fog", "true");
|
||||||
|
|
||||||
// Some (temporary) keys for debugging
|
// Some (temporary) keys for debugging
|
||||||
settings->setDefault("keymap_print_debug_stacks", "KEY_KEY_P");
|
settings->setDefault("keymap_print_debug_stacks", "KEY_KEY_P");
|
||||||
@ -268,7 +269,7 @@ void set_default_settings(Settings *settings)
|
|||||||
settings->setDefault("mgv7_np_terrain_alt", "4, 25, (600, 600, 600), 5934, 5, 0.6");
|
settings->setDefault("mgv7_np_terrain_alt", "4, 25, (600, 600, 600), 5934, 5, 0.6");
|
||||||
settings->setDefault("mgv7_np_terrain_persist", "0.6, 0.1, (500, 500, 500), 539, 3, 0.6");
|
settings->setDefault("mgv7_np_terrain_persist", "0.6, 0.1, (500, 500, 500), 539, 3, 0.6");
|
||||||
settings->setDefault("mgv7_np_height_select", "-0.5, 1, (250, 250, 250), 4213, 5, 0.69");
|
settings->setDefault("mgv7_np_height_select", "-0.5, 1, (250, 250, 250), 4213, 5, 0.69");
|
||||||
settings->setDefault("mgv7_np_filler_depth", "0, 1.2, (150, 150, 150), 261, 4, 0.7");
|
settings->setDefault("mgv7_np_filler_depth", "0, 1.2, (150, 150, 150), 261, 4, 0.7");
|
||||||
settings->setDefault("mgv7_np_mount_height", "100, 30, (500, 500, 500), 72449, 4, 0.6");
|
settings->setDefault("mgv7_np_mount_height", "100, 30, (500, 500, 500), 72449, 4, 0.6");
|
||||||
settings->setDefault("mgv7_np_ridge_uwater", "0, 1, (500, 500, 500), 85039, 4, 0.6");
|
settings->setDefault("mgv7_np_ridge_uwater", "0, 1, (500, 500, 500), 85039, 4, 0.6");
|
||||||
settings->setDefault("mgv7_np_mountain", "0, 1, (250, 350, 250), 5333, 5, 0.68");
|
settings->setDefault("mgv7_np_mountain", "0, 1, (250, 350, 250), 5333, 5, 0.68");
|
||||||
|
78
src/sky.cpp
78
src/sky.cpp
@ -9,6 +9,7 @@
|
|||||||
#include "profiler.h"
|
#include "profiler.h"
|
||||||
#include "util/numeric.h" // MYMIN
|
#include "util/numeric.h" // MYMIN
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
#include "settings.h"
|
||||||
|
|
||||||
//! constructor
|
//! constructor
|
||||||
Sky::Sky(scene::ISceneNode* parent, scene::ISceneManager* mgr, s32 id, LocalPlayer* player):
|
Sky::Sky(scene::ISceneNode* parent, scene::ISceneManager* mgr, s32 id, LocalPlayer* player):
|
||||||
@ -56,6 +57,8 @@ Sky::Sky(scene::ISceneNode* parent, scene::ISceneManager* mgr, s32 id, LocalPlay
|
|||||||
);
|
);
|
||||||
m_stars[i].normalize();
|
m_stars[i].normalize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_directional_colored_fog = g_settings->getBool("directional_colored_fog");
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sky::OnRegisterSceneNode()
|
void Sky::OnRegisterSceneNode()
|
||||||
@ -482,32 +485,34 @@ void Sky::update(float time_of_day, float time_brightness,
|
|||||||
|
|
||||||
// Horizon coloring based on sun and moon direction during sunset and sunrise
|
// Horizon coloring based on sun and moon direction during sunset and sunrise
|
||||||
video::SColor pointcolor = video::SColor(255, 255, 255, m_bgcolor.getAlpha());
|
video::SColor pointcolor = video::SColor(255, 255, 255, m_bgcolor.getAlpha());
|
||||||
if (m_horizon_blend() != 0)
|
if (m_directional_colored_fog) {
|
||||||
{
|
if (m_horizon_blend() != 0)
|
||||||
// calculate hemisphere value from yaw
|
{
|
||||||
f32 pointcolor_blend = wrapDegrees_0_360(m_player->getYaw() + 90);
|
// calculate hemisphere value from yaw
|
||||||
if (pointcolor_blend > 180)
|
f32 pointcolor_blend = wrapDegrees_0_360(m_player->getYaw() + 90);
|
||||||
pointcolor_blend = 360 - pointcolor_blend;
|
if (pointcolor_blend > 180)
|
||||||
pointcolor_blend /= 180;
|
pointcolor_blend = 360 - pointcolor_blend;
|
||||||
// bound view angle to determine where transition starts and ends
|
pointcolor_blend /= 180;
|
||||||
pointcolor_blend = rangelim(1 - pointcolor_blend * 1.375, 0, 1 / 1.375) * 1.375;
|
// bound view angle to determine where transition starts and ends
|
||||||
// combine the colors when looking up or down, otherwise turning looks weird
|
pointcolor_blend = rangelim(1 - pointcolor_blend * 1.375, 0, 1 / 1.375) * 1.375;
|
||||||
pointcolor_blend += (0.5 - pointcolor_blend) * (1 - MYMIN((90 - std::abs(m_player->getPitch())) / 90 * 1.5, 1));
|
// combine the colors when looking up or down, otherwise turning looks weird
|
||||||
// invert direction to match where the sun and moon are rising
|
pointcolor_blend += (0.5 - pointcolor_blend) * (1 - MYMIN((90 - std::abs(m_player->getPitch())) / 90 * 1.5, 1));
|
||||||
if (m_time_of_day > 0.5)
|
// invert direction to match where the sun and moon are rising
|
||||||
pointcolor_blend = 1 - pointcolor_blend;
|
if (m_time_of_day > 0.5)
|
||||||
|
pointcolor_blend = 1 - pointcolor_blend;
|
||||||
|
|
||||||
// horizon colors of sun and moon
|
// horizon colors of sun and moon
|
||||||
f32 pointcolor_light = rangelim(m_time_brightness * 3, 0.2, 1);
|
f32 pointcolor_light = rangelim(m_time_brightness * 3, 0.2, 1);
|
||||||
video::SColorf pointcolor_sun_f(1, 1, 1, 1);
|
video::SColorf pointcolor_sun_f(1, 1, 1, 1);
|
||||||
pointcolor_sun_f.r = pointcolor_light * 1;
|
pointcolor_sun_f.r = pointcolor_light * 1;
|
||||||
pointcolor_sun_f.b = pointcolor_light * (0.25 + (rangelim(m_time_brightness, 0.25, 0.75) - 0.25) * 2 * 0.75);
|
pointcolor_sun_f.b = pointcolor_light * (0.25 + (rangelim(m_time_brightness, 0.25, 0.75) - 0.25) * 2 * 0.75);
|
||||||
pointcolor_sun_f.g = pointcolor_light * (pointcolor_sun_f.b * 0.375 + (rangelim(m_time_brightness, 0.05, 0.15) - 0.05) * 10 * 0.625);
|
pointcolor_sun_f.g = pointcolor_light * (pointcolor_sun_f.b * 0.375 + (rangelim(m_time_brightness, 0.05, 0.15) - 0.05) * 10 * 0.625);
|
||||||
video::SColorf pointcolor_moon_f(0.5 * pointcolor_light, 0.6 * pointcolor_light, 0.8 * pointcolor_light, 1);
|
video::SColorf pointcolor_moon_f(0.5 * pointcolor_light, 0.6 * pointcolor_light, 0.8 * pointcolor_light, 1);
|
||||||
video::SColor pointcolor_sun = pointcolor_sun_f.toSColor();
|
video::SColor pointcolor_sun = pointcolor_sun_f.toSColor();
|
||||||
video::SColor pointcolor_moon = pointcolor_moon_f.toSColor();
|
video::SColor pointcolor_moon = pointcolor_moon_f.toSColor();
|
||||||
// calculate the blend color
|
// calculate the blend color
|
||||||
pointcolor = m_mix_scolor(pointcolor_moon, pointcolor_sun, pointcolor_blend);
|
pointcolor = m_mix_scolor(pointcolor_moon, pointcolor_sun, pointcolor_blend);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
video::SColor bgcolor_bright = m_bgcolor_bright_f.toSColor();
|
video::SColor bgcolor_bright = m_bgcolor_bright_f.toSColor();
|
||||||
@ -516,7 +521,9 @@ void Sky::update(float time_of_day, float time_brightness,
|
|||||||
bgcolor_bright.getRed() * m_brightness,
|
bgcolor_bright.getRed() * m_brightness,
|
||||||
bgcolor_bright.getGreen() * m_brightness,
|
bgcolor_bright.getGreen() * m_brightness,
|
||||||
bgcolor_bright.getBlue() * m_brightness);
|
bgcolor_bright.getBlue() * m_brightness);
|
||||||
m_bgcolor = m_mix_scolor(m_bgcolor, pointcolor, m_horizon_blend() * 0.5);
|
if (m_directional_colored_fog) {
|
||||||
|
m_bgcolor = m_mix_scolor(m_bgcolor, pointcolor, m_horizon_blend() * 0.5);
|
||||||
|
}
|
||||||
|
|
||||||
video::SColor skycolor_bright = m_skycolor_bright_f.toSColor();
|
video::SColor skycolor_bright = m_skycolor_bright_f.toSColor();
|
||||||
m_skycolor = video::SColor(
|
m_skycolor = video::SColor(
|
||||||
@ -524,11 +531,20 @@ void Sky::update(float time_of_day, float time_brightness,
|
|||||||
skycolor_bright.getRed() * m_brightness,
|
skycolor_bright.getRed() * m_brightness,
|
||||||
skycolor_bright.getGreen() * m_brightness,
|
skycolor_bright.getGreen() * m_brightness,
|
||||||
skycolor_bright.getBlue() * m_brightness);
|
skycolor_bright.getBlue() * m_brightness);
|
||||||
m_skycolor = m_mix_scolor(m_skycolor, pointcolor, m_horizon_blend() * 0.25);
|
if (m_directional_colored_fog) {
|
||||||
|
m_skycolor = m_mix_scolor(m_skycolor, pointcolor, m_horizon_blend() * 0.25);
|
||||||
|
}
|
||||||
|
|
||||||
float cloud_direct_brightness = 0;
|
float cloud_direct_brightness = 0;
|
||||||
if(sunlight_seen){
|
if(sunlight_seen) {
|
||||||
cloud_direct_brightness = MYMIN(m_horizon_blend() * 0.15 + m_time_brightness, 1);
|
if (!m_directional_colored_fog) {
|
||||||
|
cloud_direct_brightness = time_brightness;
|
||||||
|
if(time_brightness >= 0.2 && time_brightness < 0.7)
|
||||||
|
cloud_direct_brightness *= 1.3;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
cloud_direct_brightness = MYMIN(m_horizon_blend() * 0.15 + m_time_brightness, 1);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
cloud_direct_brightness = direct_brightness;
|
cloud_direct_brightness = direct_brightness;
|
||||||
}
|
}
|
||||||
@ -539,7 +555,9 @@ void Sky::update(float time_of_day, float time_brightness,
|
|||||||
m_cloudcolor_bright_f.g * m_cloud_brightness,
|
m_cloudcolor_bright_f.g * m_cloud_brightness,
|
||||||
m_cloudcolor_bright_f.b * m_cloud_brightness,
|
m_cloudcolor_bright_f.b * m_cloud_brightness,
|
||||||
1.0);
|
1.0);
|
||||||
m_cloudcolor_f = m_mix_scolorf(m_cloudcolor_f, video::SColorf(pointcolor), m_horizon_blend() * 0.75);
|
if (m_directional_colored_fog) {
|
||||||
|
m_cloudcolor_f = m_mix_scolorf(m_cloudcolor_f, video::SColorf(pointcolor), m_horizon_blend() * 0.75);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -105,6 +105,7 @@ private:
|
|||||||
float m_brightness;
|
float m_brightness;
|
||||||
float m_cloud_brightness;
|
float m_cloud_brightness;
|
||||||
bool m_clouds_visible;
|
bool m_clouds_visible;
|
||||||
|
bool m_directional_colored_fog;
|
||||||
video::SColorf m_bgcolor_bright_f;
|
video::SColorf m_bgcolor_bright_f;
|
||||||
video::SColorf m_skycolor_bright_f;
|
video::SColorf m_skycolor_bright_f;
|
||||||
video::SColorf m_cloudcolor_bright_f;
|
video::SColorf m_cloudcolor_bright_f;
|
||||||
|
Loading…
Reference in New Issue
Block a user