mirror of
https://github.com/luanti-org/luanti.git
synced 2025-09-15 18:57:08 +00:00
Fixes and Lua control
This commit is contained in:
parent
45289b6919
commit
b3710a982e
10 changed files with 34 additions and 13 deletions
|
@ -196,7 +196,6 @@ void Clouds::updateMesh()
|
|||
const f32 rz = cloud_size / 2;
|
||||
|
||||
bool soft_clouds_enabled = g_settings->getBool("soft_clouds");
|
||||
bool shaded_clouds_enabled = soft_clouds_enabled && g_settings->getBool("enable_dynamic_shadows") && g_settings->getBool("enable_3d_clouds");
|
||||
|
||||
v3f pos(p0.X, m_params.height * BS, p0.Y);
|
||||
|
||||
|
|
|
@ -414,6 +414,8 @@ class GameGlobalShaderConstantSetter : public IShaderConstantSetter
|
|||
CachedPixelShaderSetting<float> m_vignette_dark_pixel{"vignette_dark"};
|
||||
CachedPixelShaderSetting<float> m_vignette_bright_pixel{"vignette_bright"};
|
||||
CachedPixelShaderSetting<float> m_vignette_power_pixel{"vignette_power"};
|
||||
CachedPixelShaderSetting<float> m_foliage_translucency_pixel{ "foliage_translucency" };
|
||||
CachedPixelShaderSetting<float> m_specular_intensity_pixel{ "specular_intensity" };
|
||||
|
||||
static constexpr std::array<const char*, 1> SETTING_CALLBACKS = {
|
||||
"exposure_compensation",
|
||||
|
@ -531,6 +533,9 @@ public:
|
|||
m_vignette_bright_pixel.set(&vignette_params.bright, services);
|
||||
m_vignette_power_pixel.set(&vignette_params.power, services);
|
||||
|
||||
m_foliage_translucency_pixel.set(&lighting.foliage_translucency, services);
|
||||
m_specular_intensity_pixel.set(&lighting.specular_intensity, services);
|
||||
|
||||
if (g_settings->getBool("enable_color_grading")) {
|
||||
const ColorDecisionList& cdl_params = lighting.cdl;
|
||||
core::vector3df slope = cdl_params.slope;
|
||||
|
|
|
@ -176,7 +176,6 @@ void MeshUpdateQueue::done(v3s16 pos)
|
|||
void MeshUpdateQueue::fillDataFromMapBlocks(QueuedMeshUpdate *q)
|
||||
{
|
||||
auto mesh_grid = m_client->getMeshGrid();
|
||||
|
||||
MeshMakeData *data = new MeshMakeData(m_client->ndef(), MAP_BLOCKSIZE * mesh_grid.cell_size);
|
||||
q->data = data;
|
||||
|
||||
|
|
|
@ -56,9 +56,9 @@ struct Vignette {
|
|||
*
|
||||
*/
|
||||
struct ColorDecisionList {
|
||||
core::vector3df slope{1.2, 1.0, 0.8};
|
||||
core::vector3df slope{1.0, 1.0, 1.0};
|
||||
core::vector3df offset{0.0, 0.0, 0.0};
|
||||
core::vector3df power{1.25, 1.0, 0.9};
|
||||
core::vector3df power{1.0, 1.0, 1.0};
|
||||
};
|
||||
|
||||
/** Describes ambient light settings for a player
|
||||
|
@ -71,6 +71,8 @@ struct Lighting
|
|||
float shadow_intensity {0.0f};
|
||||
float saturation {1.0f};
|
||||
float volumetric_light_strength {0.0f};
|
||||
float foliage_translucency{1.5f};
|
||||
float specular_intensity{1.5f};
|
||||
// These factors are calculated based on expected value of scattering factor of 1e-5
|
||||
// for Nitrogen at 532nm (green), 2e25 molecules/m3 in atmosphere
|
||||
core::vector3df volumetric_beta_r0{ 3.3362176e-01, 8.75378289198826e-01, 1.95342379700656 };
|
||||
|
|
|
@ -1817,7 +1817,7 @@ void Client::handleCommand_SetLighting(NetworkPacket *pkt)
|
|||
>> lighting.bloom_radius;
|
||||
if (pkt->getRemainingBytes() >= 4)
|
||||
*pkt >> lighting.artificial_light_color;
|
||||
if (pkt->getRemainingBytes() >= 60)
|
||||
if (pkt->getRemainingBytes() >= 68)
|
||||
*pkt >> lighting.volumetric_beta_r0;
|
||||
*pkt >> lighting.vignette.dark
|
||||
>> lighting.vignette.bright
|
||||
|
@ -1825,5 +1825,7 @@ void Client::handleCommand_SetLighting(NetworkPacket *pkt)
|
|||
*pkt >> lighting.cdl.slope;
|
||||
*pkt >> lighting.cdl.offset;
|
||||
*pkt >> lighting.cdl.power;
|
||||
*pkt >> lighting.foliage_translucency;
|
||||
*pkt >> lighting.specular_intensity;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -58,7 +58,7 @@
|
|||
Rename TOCLIENT_DEATHSCREEN to TOCLIENT_DEATHSCREEN_LEGACY
|
||||
Rename TOSERVER_RESPAWN to TOSERVER_RESPAWN_LEGACY
|
||||
Support float animation frame numbers in TOCLIENT_LOCAL_PLAYER_ANIMATIONS
|
||||
Add beta_r0, vignette and cdl parameters to Lighting packets
|
||||
Add beta_r0, vignette, specular intensity, foliage translucency and cdl parameters to Lighting packets
|
||||
[scheduled bump for 5.10.0]
|
||||
*/
|
||||
|
||||
|
|
|
@ -2623,6 +2623,8 @@ int ObjectRef::l_set_lighting(lua_State *L)
|
|||
lua_pop(L, 1); // shadows
|
||||
|
||||
getfloatfield(L, -1, "saturation", lighting.saturation);
|
||||
getfloatfield(L, -1, "foliage_translucency", lighting.foliage_translucency);
|
||||
getfloatfield(L, -1, "specular_intensity", lighting.specular_intensity);
|
||||
|
||||
lua_getfield(L, 2, "exposure");
|
||||
if (lua_istable(L, -1)) {
|
||||
|
@ -2700,6 +2702,10 @@ int ObjectRef::l_get_lighting(lua_State *L)
|
|||
lua_newtable(L); // result
|
||||
push_ARGB8(L, lighting.artificial_light_color);
|
||||
lua_setfield(L, -2, "artificial_light");
|
||||
lua_pushnumber(L, lighting.foliage_translucency);
|
||||
lua_setfield(L, -2, "foliage_translucency");
|
||||
lua_pushnumber(L, lighting.specular_intensity);
|
||||
lua_setfield(L, -2, "specular_intensity");
|
||||
lua_newtable(L); // "shadows"
|
||||
lua_pushnumber(L, lighting.shadow_intensity);
|
||||
lua_setfield(L, -2, "intensity");
|
||||
|
|
|
@ -1926,6 +1926,8 @@ void Server::SendSetLighting(session_t peer_id, const Lighting & lighting)
|
|||
pkt << lighting.cdl.slope;
|
||||
pkt << lighting.cdl.offset;
|
||||
pkt << lighting.cdl.power;
|
||||
pkt << lighting.foliage_translucency;
|
||||
pkt << lighting.specular_intensity;
|
||||
|
||||
Send(&pkt);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue