1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Implement mapblock camera offset correctly (#10702)

Implement mapblock camera offset correctly - reduce client jitter

Co-authored-by: hecktest <>
This commit is contained in:
hecks 2020-12-06 00:03:40 +01:00 committed by GitHub
parent 07e0b527cf
commit 6d7067fd37
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 63 additions and 74 deletions

View file

@ -1175,13 +1175,6 @@ MapBlockMesh::MapBlockMesh(MeshMakeData *data, v3s16 camera_offset):
buf->drop();
}
/*
Do some stuff to the mesh
*/
m_camera_offset = camera_offset;
translateMesh(m_mesh[layer],
intToFloat(data->m_blockpos * MAP_BLOCKSIZE - camera_offset, BS));
if (m_mesh[layer]) {
#if 0
// Usually 1-700 faces and 1-7 materials
@ -1308,19 +1301,6 @@ bool MapBlockMesh::animate(bool faraway, float time, int crack,
return true;
}
void MapBlockMesh::updateCameraOffset(v3s16 camera_offset)
{
if (camera_offset != m_camera_offset) {
for (scene::IMesh *layer : m_mesh) {
translateMesh(layer,
intToFloat(m_camera_offset - camera_offset, BS));
if (m_enable_vbo)
layer->setDirty();
}
m_camera_offset = camera_offset;
}
}
video::SColor encode_light(u16 light, u8 emissive_light)
{
// Get components