mirror of
https://github.com/luanti-org/luanti.git
synced 2025-10-13 16:45:20 +02:00
Fix rendering glitches when far from the center of the map
This commit is contained in:
@@ -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
|
||||
*/
|
||||
|
Reference in New Issue
Block a user