diff options
Diffstat (limited to 'src/mapblock_mesh.cpp')
-rw-r--r-- | src/mapblock_mesh.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/mapblock_mesh.cpp b/src/mapblock_mesh.cpp index afea3dcce..ef05acbb7 100644 --- a/src/mapblock_mesh.cpp +++ b/src/mapblock_mesh.cpp @@ -1030,7 +1030,7 @@ static void updateAllFastFaceRows(MeshMakeData *data, MapBlockMesh */ -MapBlockMesh::MapBlockMesh(MeshMakeData *data): +MapBlockMesh::MapBlockMesh(MeshMakeData *data, v3s16 camera_offset): m_mesh(new scene::SMesh()), m_gamedef(data->m_gamedef), m_animation_force_timer(0), // force initial animation @@ -1248,11 +1248,13 @@ MapBlockMesh::MapBlockMesh(MeshMakeData *data): &p.indices[0], p.indices.size()); } + m_camera_offset = camera_offset; + /* Do some stuff to the mesh */ - translateMesh(m_mesh, intToFloat(data->m_blockpos * MAP_BLOCKSIZE, BS)); + translateMesh(m_mesh, intToFloat(data->m_blockpos * MAP_BLOCKSIZE - camera_offset, BS)); if(m_mesh) { @@ -1415,6 +1417,14 @@ bool MapBlockMesh::animate(bool faraway, float time, int crack, u32 daynight_rat return true; } +void MapBlockMesh::updateCameraOffset(v3s16 camera_offset) +{ + if (camera_offset != m_camera_offset) { + translateMesh(m_mesh, intToFloat(m_camera_offset-camera_offset, BS)); + m_camera_offset = camera_offset; + } +} + /* MeshCollector */ |