Fix to to too two times
[oweals/minetest.git] / src / mapblock_mesh.h
index 5b33990c602fd6ce863bfda4b63173f413267a96..7f52317383a02435930a98983e7525299f7667c4 100644 (file)
@@ -81,7 +81,7 @@ class MapBlockMesh
 {
 public:
        // Builds the mesh given
-       MapBlockMesh(MeshMakeData *data);
+       MapBlockMesh(MeshMakeData *data, v3s16 camera_offset);
        ~MapBlockMesh();
 
        // Main animation function, parameters:
@@ -107,6 +107,8 @@ public:
                if(m_animation_force_timer > 0)
                        m_animation_force_timer--;
        }
+       
+       void updateCameraOffset(v3s16 camera_offset);
 
 private:
        scene::SMesh *m_mesh;
@@ -133,6 +135,9 @@ private:
        u32 m_last_daynight_ratio;
        // For each meshbuffer, maps vertex indices to (day,night) pairs
        std::map<u32, std::map<u32, std::pair<u8, u8> > > m_daynight_diffs;
+       
+       // Camera offset info -> do we have to translate the mesh?
+       v3s16 m_camera_offset;
 };
 
 
@@ -143,13 +148,13 @@ private:
 struct PreMeshBuffer
 {
        TileSpec tile;
-       core::array<u16> indices;
-       core::array<video::S3DVertex> vertices;
+       std::vector<u16> indices;
+       std::vector<video::S3DVertex> vertices;
 };
 
 struct MeshCollector
 {
-       core::array<PreMeshBuffer> prebuffers;
+       std::vector<PreMeshBuffer> prebuffers;
 
        void append(const TileSpec &material,
                        const video::S3DVertex *vertices, u32 numVertices,
@@ -167,8 +172,8 @@ inline video::SColor MapBlock_LightColor(u8 alpha, u16 light, u8 light_source=0)
 }
 
 // Compute light at node
-u16 getInteriorLight(MapNode n, s32 increment, MeshMakeData *data);
-u16 getFaceLight(MapNode n, MapNode n2, v3s16 face_dir, MeshMakeData *data);
+u16 getInteriorLight(MapNode n, s32 increment, INodeDefManager *ndef);
+u16 getFaceLight(MapNode n, MapNode n2, v3s16 face_dir, INodeDefManager *ndef);
 u16 getSmoothLight(v3s16 p, v3s16 corner, MeshMakeData *data);
 
 // Retrieves the TileSpec of a face of a node