mirror of
https://github.com/luanti-org/luanti.git
synced 2025-08-06 17:41:04 +00:00
Undo changes to the clouds
This commit is contained in:
parent
ba31db3eef
commit
6b6baf3fd7
1 changed files with 187 additions and 183 deletions
|
@ -13,6 +13,7 @@
|
|||
#include "settings.h"
|
||||
#include <cmath>
|
||||
|
||||
class Clouds;
|
||||
scene::ISceneManager* g_menucloudsmgr = nullptr;
|
||||
Clouds* g_menuclouds = nullptr;
|
||||
|
||||
|
@ -90,13 +91,16 @@ void Clouds::updateMesh()
|
|||
|
||||
if (!m_mesh_valid) {
|
||||
// mesh was never created or invalidated
|
||||
} else if (m_mesh_origin.getDistanceFrom(m_origin) >= max_d) {
|
||||
}
|
||||
else if (m_mesh_origin.getDistanceFrom(m_origin) >= max_d) {
|
||||
// clouds moved
|
||||
} else if (center_of_drawing_in_noise_i != m_last_noise_center) {
|
||||
}
|
||||
else if (center_of_drawing_in_noise_i != m_last_noise_center) {
|
||||
// noise offset changed
|
||||
// I think in practice this never happens due to the camera offset
|
||||
// being smaller than the cloud size.(?)
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -190,15 +194,6 @@ void Clouds::updateMesh()
|
|||
|
||||
v2f p0 = v2f(xi, zi) * cloud_size + world_center_of_drawing_in_noise_f;
|
||||
|
||||
const f32 rx = cloud_size / 2.0f;
|
||||
// if clouds are flat, the top layer should be at the given height
|
||||
const f32 ry = is3D() ? m_params.thickness * BS : 0.0f;
|
||||
const f32 rz = cloud_size / 2;
|
||||
|
||||
bool soft_clouds_enabled = g_settings->getBool("soft_clouds");
|
||||
|
||||
v3f pos(p0.X, m_params.height * BS, p0.Y);
|
||||
|
||||
video::S3DVertex v[4] = {
|
||||
video::S3DVertex(0,0,0, 0,0,0, c_top, 0, 1),
|
||||
video::S3DVertex(0,0,0, 0,0,0, c_top, 1, 1),
|
||||
|
@ -206,6 +201,12 @@ void Clouds::updateMesh()
|
|||
video::S3DVertex(0,0,0, 0,0,0, c_top, 0, 0)
|
||||
};
|
||||
|
||||
const f32 rx = cloud_size / 2.0f;
|
||||
// if clouds are flat, the top layer should be at the given height
|
||||
const f32 ry = is3D() ? m_params.thickness * BS : 0.0f;
|
||||
const f32 rz = cloud_size / 2;
|
||||
|
||||
bool soft_clouds_enabled = g_settings->getBool("soft_clouds");
|
||||
for (u32 i = 0; i < num_faces_to_draw; i++)
|
||||
{
|
||||
switch (i)
|
||||
|
@ -327,6 +328,8 @@ void Clouds::updateMesh()
|
|||
break;
|
||||
}
|
||||
|
||||
v3f pos(p0.X, m_params.height * BS, p0.Y);
|
||||
|
||||
for (video::S3DVertex& vertex : v) {
|
||||
vertex.Pos += pos;
|
||||
vertices.push_back(vertex);
|
||||
|
@ -341,7 +344,8 @@ void Clouds::updateMesh()
|
|||
if (mb->getIndexCount() > index_count) {
|
||||
indices.resize(index_count);
|
||||
mb->setDirty(scene::EBT_INDEX);
|
||||
} else if (mb->getIndexCount() < index_count) {
|
||||
}
|
||||
else if (mb->getIndexCount() < index_count) {
|
||||
const u32 start = mb->getIndexCount() / 6;
|
||||
assert(start * 6 == mb->getIndexCount());
|
||||
for (u32 k = start; k < quad_count; k++) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue