]> git.lizzy.rs Git - minetest.git/blobdiff - src/client/mapblock_mesh.h
8x block meshes (#13133)
[minetest.git] / src / client / mapblock_mesh.h
index 7f6185c3a1a575bb7fd47974711e51042d698055..82e9a0f22cf15b92e9432dda5900c43696d3014f 100644 (file)
@@ -24,6 +24,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "voxel.h"
 #include <array>
 #include <map>
+#include <unordered_map>
 
 class Client;
 class IShaderSource;
@@ -42,6 +43,7 @@ struct MeshMakeData
        v3s16 m_blockpos = v3s16(-1337,-1337,-1337);
        v3s16 m_crack_pos_relative = v3s16(-1337,-1337,-1337);
        bool m_smooth_lighting = false;
+       u16 side_length = MAP_BLOCKSIZE;
 
        Client *m_client;
        bool m_use_shaders;
@@ -54,12 +56,6 @@ struct MeshMakeData
        void fillBlockDataBegin(const v3s16 &blockpos);
        void fillBlockData(const v3s16 &block_offset, MapNode *data);
 
-       /*
-               Copy central data directly from block, and other data from
-               parent of block.
-       */
-       void fill(MapBlock *block);
-
        /*
                Set the (node) position of a crack
        */
@@ -108,7 +104,7 @@ class MapBlockBspTree
 public:
        MapBlockBspTree() {}
 
-       void buildTree(const std::vector<MeshTriangle> *triangles);
+       void buildTree(const std::vector<MeshTriangle> *triangles, u16 side_lingth);
 
        void traverse(v3f viewpoint, std::vector<s32> &output) const
        {
@@ -203,11 +199,11 @@ class MapBlockMesh
                return m_mesh[layer];
        }
 
-       MinimapMapblock *moveMinimapMapblock()
+       std::vector<MinimapMapblock*> moveMinimapMapblocks()
        {
-               MinimapMapblock *p = m_minimap_mapblock;
-               m_minimap_mapblock = NULL;
-               return p;
+               std::vector<MinimapMapblock*> minimap_mapblocks;
+               minimap_mapblocks.swap(m_minimap_mapblocks);
+               return minimap_mapblocks;
        }
 
        bool isAnimationForced() const
@@ -245,7 +241,7 @@ class MapBlockMesh
        };
 
        scene::IMesh *m_mesh[MAX_TILE_LAYERS];
-       MinimapMapblock *m_minimap_mapblock;
+       std::vector<MinimapMapblock*> m_minimap_mapblocks;
        ITextureSource *m_tsrc;
        IShaderSource *m_shdrsrc;
 
@@ -344,4 +340,4 @@ void getNodeTile(MapNode mn, const v3s16 &p, const v3s16 &dir, MeshMakeData *dat
 /// Return bitset of the sides of the mapblock that consist of solid nodes only
 /// Bits:
 /// 0 0 -Z +Z -X +X -Y +Y
-u8 get_solid_sides(MeshMakeData *data);
+std::unordered_map<v3s16, u8> get_solid_sides(MeshMakeData *data);