1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Don't recalculate meshnode normals unnecessarily

This commit is contained in:
sfan5 2024-12-07 12:59:40 +01:00
parent eb6731bdc6
commit 21437090b8
4 changed files with 23 additions and 18 deletions

View file

@ -943,14 +943,17 @@ void ContentFeatures::updateTextures(ITextureSource *tsrc, IShaderSource *shdsrc
palette = tsrc->getPalette(palette_name);
if (drawtype == NDT_MESH && !mesh.empty()) {
// Meshnode drawtype
// Read the mesh and apply scale
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);
if (!checkMeshNormals(mesh_ptr)) {
infostream << "ContentFeatures: recalculating normals for mesh "
<< mesh << std::endl;
meshmanip->recalculateNormals(mesh_ptr, true, false);
}
}
}
}