aboutsummaryrefslogtreecommitdiff
path: root/src/util/directiontables.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/util/directiontables.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/util/directiontables.cpp')
-rw-r--r--src/util/directiontables.cpp72
1 files changed, 72 insertions, 0 deletions
diff --git a/src/util/directiontables.cpp b/src/util/directiontables.cpp
index 297058c9c..86ea6a45f 100644
--- a/src/util/directiontables.cpp
+++ b/src/util/directiontables.cpp
@@ -110,6 +110,78 @@ const v3s16 g_27dirs[27] =
v3s16(0,0,0),
};
+const v3s16 g_64dirs[64] =
+{
+ // +right, +top, +back
+ v3s16( -1, -1, -1),
+ v3s16( -1, 0, -1),
+ v3s16( -1, 1, -1),
+ v3s16( -1, 2, -1),
+ v3s16( -1, -1, 0),
+ v3s16( -1, 0, 0),
+ v3s16( -1, 1, 0),
+ v3s16( -1, 2, 0),
+ v3s16( -1, -1, 1),
+ v3s16( -1, 0, 1),
+ v3s16( -1, 1, 1),
+ v3s16( -1, 2, 1),
+ v3s16( -1, -1, 2),
+ v3s16( -1, 0, 2),
+ v3s16( -1, 1, 2),
+ v3s16( -1, 2, 2),
+
+ v3s16( 0, -1, -1),
+ v3s16( 0, 0, -1),
+ v3s16( 0, 1, -1),
+ v3s16( 0, 2, -1),
+ v3s16( 0, -1, 0),
+ v3s16( 0, 0, 0),
+ v3s16( 0, 1, 0),
+ v3s16( 0, 2, 0),
+ v3s16( 0, -1, 1),
+ v3s16( 0, 0, 1),
+ v3s16( 0, 1, 1),
+ v3s16( 0, 2, 1),
+ v3s16( 0, -1, 2),
+ v3s16( 0, 0, 2),
+ v3s16( 0, 1, 2),
+ v3s16( 0, 2, 2),
+
+ v3s16( 1, -1, -1),
+ v3s16( 1, 0, -1),
+ v3s16( 1, 1, -1),
+ v3s16( 1, 2, -1),
+ v3s16( 1, -1, 0),
+ v3s16( 1, 0, 0),
+ v3s16( 1, 1, 0),
+ v3s16( 1, 2, 0),
+ v3s16( 1, -1, 1),
+ v3s16( 1, 0, 1),
+ v3s16( 1, 1, 1),
+ v3s16( 1, 2, 1),
+ v3s16( 1, -1, 2),
+ v3s16( 1, 0, 2),
+ v3s16( 1, 1, 2),
+ v3s16( 1, 2, 2),
+
+ v3s16( 2, -1, -1),
+ v3s16( 2, 0, -1),
+ v3s16( 2, 1, -1),
+ v3s16( 2, 2, -1),
+ v3s16( 2, -1, 0),
+ v3s16( 2, 0, 0),
+ v3s16( 2, 1, 0),
+ v3s16( 2, 2, 0),
+ v3s16( 2, -1, 1),
+ v3s16( 2, 0, 1),
+ v3s16( 2, 1, 1),
+ v3s16( 2, 2, 1),
+ v3s16( 2, -1, 2),
+ v3s16( 2, 0, 2),
+ v3s16( 2, 1, 2),
+ v3s16( 2, 2, 2),
+};
+
const u8 wallmounted_to_facedir[6] = {
20,
0,