aboutsummaryrefslogtreecommitdiff
path: root/src/client/content_mapblock.cpp
diff options
context:
space:
mode:
authorx2048 <codeforsmile@gmail.com>2023-01-31 17:30:59 +0100
committerGitHub <noreply@github.com>2023-01-31 17:30:59 +0100
commit69fc20610947610b7829f3bfad82e23ed705b764 (patch)
tree775cb27a4875a071fccddee87b80730e39ed9b14 /src/client/content_mapblock.cpp
parentcded6a3945206e51c35adbd063f1aec3a47e310f (diff)
downloadminetest-69fc20610947610b7829f3bfad82e23ed705b764.tar.xz
8x block meshes (#13133)
Reduce the number of drawcalls by generating a mesh per 8 blocks (2x2x2). Only blocks with even coordinates (lowest bit set to 0) will get a mesh. Note: This also removes the old 'loops' algorithm for building the draw list, because it produces visual artifacts and cannot be made compatible with the approach of having a mesh for every 8th block without hurting performance. Co-authored-by: Jude Melton-Houghton <jwmhjwmh@gmail.com> Co-authored-by: Lars <larsh@apache.org> Co-authored-by: sfan5 <sfan5@live.de>
Diffstat (limited to 'src/client/content_mapblock.cpp')
-rw-r--r--src/client/content_mapblock.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/client/content_mapblock.cpp b/src/client/content_mapblock.cpp
index 1cd1f1441..4db72c75f 100644
--- a/src/client/content_mapblock.cpp
+++ b/src/client/content_mapblock.cpp
@@ -1619,9 +1619,9 @@ void MapblockMeshGenerator::drawNode()
*/
void MapblockMeshGenerator::generate()
{
- for (p.Z = 0; p.Z < MAP_BLOCKSIZE; p.Z++)
- for (p.Y = 0; p.Y < MAP_BLOCKSIZE; p.Y++)
- for (p.X = 0; p.X < MAP_BLOCKSIZE; p.X++) {
+ for (p.Z = 0; p.Z < data->side_length; p.Z++)
+ for (p.Y = 0; p.Y < data->side_length; p.Y++)
+ for (p.X = 0; p.X < data->side_length; p.X++) {
n = data->m_vmanip.getNodeNoEx(blockpos_nodes + p);
f = &nodedef->get(n);
drawNode();