1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-09-15 18:57:08 +00:00

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>
This commit is contained in:
x2048 2023-01-31 17:30:59 +01:00 committed by GitHub
parent cded6a3945
commit 69fc206109
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 266 additions and 118 deletions

View file

@ -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,

View file

@ -31,6 +31,9 @@ extern const v3s16 g_26dirs[26];
// 26th is (0,0,0)
extern const v3s16 g_27dirs[27];
// all positions around an octablock in sector-first order
extern const v3s16 g_64dirs[64];
extern const u8 wallmounted_to_facedir[6];
extern const v3s16 wallmounted_dirs[8];