1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-04 12:00:25 +00:00

FTI - Fix MultiMesh init and stable behaviour

This commit is contained in:
lawnjelly
2025-06-29 12:14:54 +01:00
parent e1b4101e34
commit 02b444a988

View File

@@ -258,7 +258,20 @@ void RendererMeshStorage::multimesh_set_buffer_interpolated(RID p_multimesh, con
void RendererMeshStorage::multimesh_set_physics_interpolated(RID p_multimesh, bool p_interpolated) {
MultiMeshInterpolator *mmi = _multimesh_get_interpolator(p_multimesh);
if (mmi) {
if (p_interpolated == mmi->interpolated) {
return;
}
mmi->interpolated = p_interpolated;
// If we are turning on physics interpolation, as a convenience,
// we want to get the current buffer data from the backend,
// and reset all the instances.
if (p_interpolated) {
mmi->_data_curr = _multimesh_get_buffer(p_multimesh);
mmi->_data_prev = mmi->_data_curr;
mmi->_data_interpolated = mmi->_data_curr;
}
}
}
@@ -337,6 +350,9 @@ void RendererMeshStorage::update_interpolation_tick(bool p_process) {
// ... and that both prev and current are the same, just in case of any interpolations.
mmi->_data_prev = mmi->_data_curr;
// Update the actual stable buffer to the backend.
_multimesh_set_buffer(rid, mmi->_data_interpolated);
}
if (!mmi) {