]> git.lizzy.rs Git - minetest.git/blobdiff - src/mapblock_mesh.h
Fix lost pause support in singleplayer
[minetest.git] / src / mapblock_mesh.h
index 82268efd2948ad8e836dca639e34e06b343a6e74..7f52317383a02435930a98983e7525299f7667c4 100644 (file)
@@ -1,6 +1,6 @@
 /*
-Minetest-c55
-Copyright (C) 2010-2011 celeron55, Perttu Ahola <celeron55@gmail.com>
+Minetest
+Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
 
 This program is free software; you can redistribute it and/or modify
 it under the terms of the GNU Lesser General Public License as published by
@@ -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 @@ class MapBlockMesh
                if(m_animation_force_timer > 0)
                        m_animation_force_timer--;
        }
+       
+       void updateCameraOffset(v3s16 camera_offset);
 
 private:
        scene::SMesh *m_mesh;
@@ -133,6 +135,9 @@ class MapBlockMesh
        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 @@ class MapBlockMesh
 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,
@@ -160,14 +165,15 @@ struct MeshCollector
 //   alpha in the A channel of the returned SColor
 //   day light (0-255) in the R channel of the returned SColor
 //   night light (0-255) in the G channel of the returned SColor
-inline video::SColor MapBlock_LightColor(u8 alpha, u16 light)
+//   light source (0-255) in the B channel of the returned SColor
+inline video::SColor MapBlock_LightColor(u8 alpha, u16 light, u8 light_source=0)
 {
-       return video::SColor(alpha, (light & 0xff), (light >> 8), 0);
+       return video::SColor(alpha, (light & 0xff), (light >> 8), light_source);
 }
 
 // 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