mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
parent
0fde9ab7e8
commit
794aea8e92
35 changed files with 117 additions and 411 deletions
|
@ -270,18 +270,12 @@ void TextureSettings::readSettings()
|
|||
{
|
||||
connected_glass = g_settings->getBool("connected_glass");
|
||||
translucent_liquids = g_settings->getBool("translucent_liquids");
|
||||
bool smooth_lighting = g_settings->getBool("smooth_lighting");
|
||||
enable_mesh_cache = g_settings->getBool("enable_mesh_cache");
|
||||
enable_minimap = g_settings->getBool("enable_minimap");
|
||||
node_texture_size = std::max<u16>(g_settings->getU16("texture_min_size"), 1);
|
||||
std::string leaves_style_str = g_settings->get("leaves_style");
|
||||
std::string world_aligned_mode_str = g_settings->get("world_aligned_mode");
|
||||
std::string autoscale_mode_str = g_settings->get("autoscale_mode");
|
||||
|
||||
// Mesh cache is not supported in combination with smooth lighting
|
||||
if (smooth_lighting)
|
||||
enable_mesh_cache = false;
|
||||
|
||||
if (leaves_style_str == "fancy") {
|
||||
leaves_style = LEAVES_FANCY;
|
||||
} else if (leaves_style_str == "simple") {
|
||||
|
@ -357,8 +351,7 @@ void ContentFeatures::reset()
|
|||
drawtype = NDT_NORMAL;
|
||||
mesh.clear();
|
||||
#if CHECK_CLIENT_BUILD()
|
||||
for (auto &i : mesh_ptr)
|
||||
i = NULL;
|
||||
mesh_ptr = nullptr;
|
||||
minimap_color = video::SColor(0, 0, 0, 0);
|
||||
#endif
|
||||
visual_scale = 1.0;
|
||||
|
@ -952,48 +945,14 @@ void ContentFeatures::updateTextures(ITextureSource *tsrc, IShaderSource *shdsrc
|
|||
if (drawtype == NDT_MESH && !mesh.empty()) {
|
||||
// Meshnode drawtype
|
||||
// Read the mesh and apply scale
|
||||
mesh_ptr[0] = client->getMesh(mesh);
|
||||
if (mesh_ptr[0]){
|
||||
v3f scale = v3f(1.0, 1.0, 1.0) * BS * visual_scale;
|
||||
scaleMesh(mesh_ptr[0], scale);
|
||||
recalculateBoundingBox(mesh_ptr[0]);
|
||||
meshmanip->recalculateNormals(mesh_ptr[0], true, false);
|
||||
mesh_ptr = client->getMesh(mesh);
|
||||
if (mesh_ptr) {
|
||||
v3f scale = v3f(BS) * visual_scale;
|
||||
scaleMesh(mesh_ptr, scale);
|
||||
recalculateBoundingBox(mesh_ptr);
|
||||
meshmanip->recalculateNormals(mesh_ptr, true, false);
|
||||
}
|
||||
}
|
||||
|
||||
//Cache 6dfacedir and wallmounted rotated clones of meshes
|
||||
if (tsettings.enable_mesh_cache && mesh_ptr[0] &&
|
||||
(param_type_2 == CPT2_FACEDIR
|
||||
|| param_type_2 == CPT2_COLORED_FACEDIR)) {
|
||||
for (u16 j = 1; j < 24; j++) {
|
||||
mesh_ptr[j] = cloneMesh(mesh_ptr[0]);
|
||||
rotateMeshBy6dFacedir(mesh_ptr[j], j);
|
||||
recalculateBoundingBox(mesh_ptr[j]);
|
||||
meshmanip->recalculateNormals(mesh_ptr[j], true, false);
|
||||
}
|
||||
} else if (tsettings.enable_mesh_cache && mesh_ptr[0] &&
|
||||
(param_type_2 == CPT2_4DIR
|
||||
|| param_type_2 == CPT2_COLORED_4DIR)) {
|
||||
for (u16 j = 1; j < 4; j++) {
|
||||
mesh_ptr[j] = cloneMesh(mesh_ptr[0]);
|
||||
rotateMeshBy6dFacedir(mesh_ptr[j], j);
|
||||
recalculateBoundingBox(mesh_ptr[j]);
|
||||
meshmanip->recalculateNormals(mesh_ptr[j], true, false);
|
||||
}
|
||||
} else if (tsettings.enable_mesh_cache && mesh_ptr[0]
|
||||
&& (param_type_2 == CPT2_WALLMOUNTED ||
|
||||
param_type_2 == CPT2_COLORED_WALLMOUNTED)) {
|
||||
static const u8 wm_to_6d[6] = { 20, 0, 16 + 1, 12 + 3, 8, 4 + 2 };
|
||||
for (u16 j = 1; j < 6; j++) {
|
||||
mesh_ptr[j] = cloneMesh(mesh_ptr[0]);
|
||||
rotateMeshBy6dFacedir(mesh_ptr[j], wm_to_6d[j]);
|
||||
recalculateBoundingBox(mesh_ptr[j]);
|
||||
meshmanip->recalculateNormals(mesh_ptr[j], true, false);
|
||||
}
|
||||
rotateMeshBy6dFacedir(mesh_ptr[0], wm_to_6d[0]);
|
||||
recalculateBoundingBox(mesh_ptr[0]);
|
||||
meshmanip->recalculateNormals(mesh_ptr[0], true, false);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -1014,10 +973,8 @@ NodeDefManager::~NodeDefManager()
|
|||
{
|
||||
#if CHECK_CLIENT_BUILD()
|
||||
for (ContentFeatures &f : m_content_features) {
|
||||
for (auto &j : f.mesh_ptr) {
|
||||
if (j)
|
||||
j->drop();
|
||||
}
|
||||
if (f.mesh_ptr)
|
||||
f.mesh_ptr->drop();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue