mirror of
https://github.com/luanti-org/luanti.git
synced 2025-07-02 16:38:41 +00:00
Merge remote-tracking branch 'upstream/master' into Visuals-Vol-2
This commit is contained in:
commit
00ef9b14d0
1043 changed files with 44800 additions and 28934 deletions
|
@ -1,21 +1,6 @@
|
|||
/*
|
||||
Minetest
|
||||
Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation; either version 2.1 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
// Luanti
|
||||
// SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
// Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
|
||||
|
||||
#include "client/renderingengine.h"
|
||||
#include "client/shader.h"
|
||||
|
@ -47,16 +32,13 @@ Clouds::Clouds(scene::ISceneManager* mgr, IShaderSource *ssrc,
|
|||
m_seed(seed)
|
||||
{
|
||||
assert(ssrc);
|
||||
m_enable_shaders = g_settings->getBool("enable_shaders");
|
||||
|
||||
m_material.BackfaceCulling = true;
|
||||
m_material.FogEnable = true;
|
||||
m_material.AntiAliasing = video::EAAM_SIMPLE;
|
||||
if (m_enable_shaders) {
|
||||
{
|
||||
auto sid = ssrc->getShader("cloud_shader", TILE_MATERIAL_ALPHA);
|
||||
m_material.MaterialType = ssrc->getShaderInfo(sid).material;
|
||||
} else {
|
||||
m_material.MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL;
|
||||
}
|
||||
|
||||
m_params = SkyboxDefaults::getCloudDefaults();
|
||||
|
@ -75,10 +57,7 @@ Clouds::Clouds(scene::ISceneManager* mgr, IShaderSource *ssrc,
|
|||
|
||||
Clouds::~Clouds()
|
||||
{
|
||||
g_settings->deregisterChangedCallback("enable_3d_clouds",
|
||||
&cloud_3d_setting_changed, this);
|
||||
g_settings->deregisterChangedCallback("soft_clouds",
|
||||
&cloud_3d_setting_changed, this);
|
||||
g_settings->deregisterAllChangedCallbacks(this);
|
||||
}
|
||||
|
||||
void Clouds::OnRegisterSceneNode()
|
||||
|
@ -136,15 +115,11 @@ void Clouds::updateMesh()
|
|||
|
||||
// Colors with primitive shading
|
||||
|
||||
video::SColorf c_top_f(m_color);
|
||||
video::SColorf c_side_1_f(m_color);
|
||||
video::SColorf c_side_2_f(m_color);
|
||||
video::SColorf c_bottom_f(m_color);
|
||||
if (m_enable_shaders) {
|
||||
// shader mixes the base color, set via ColorParam
|
||||
c_top_f = c_side_1_f = c_side_2_f = c_bottom_f = video::SColorf(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
}
|
||||
video::SColorf shadow = m_params.color_shadow;
|
||||
video::SColorf c_top_f(1, 1, 1, 1);
|
||||
video::SColorf c_side_1_f(1, 1, 1, 1);
|
||||
video::SColorf c_side_2_f(1, 1, 1, 1);
|
||||
video::SColorf c_bottom_f(1, 1, 1, 1);
|
||||
const video::SColorf shadow = m_params.color_shadow;
|
||||
|
||||
c_side_1_f.r *= shadow.r * 0.25f + 0.75f;
|
||||
c_side_1_f.g *= shadow.g * 0.25f + 0.75f;
|
||||
|
@ -407,8 +382,7 @@ void Clouds::render()
|
|||
}
|
||||
|
||||
m_material.BackfaceCulling = is3D();
|
||||
if (m_enable_shaders)
|
||||
m_material.ColorParam = m_color.toSColor();
|
||||
m_material.ColorParam = m_color.toSColor();
|
||||
|
||||
driver->setTransform(video::ETS_WORLD, AbsoluteTransformation);
|
||||
driver->setMaterial(m_material);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue