You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-13 13:31:48 +00:00
FTI - Fix MultiMesh init and stable behaviour
This commit is contained in:
@@ -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) {
|
void RendererMeshStorage::multimesh_set_physics_interpolated(RID p_multimesh, bool p_interpolated) {
|
||||||
MultiMeshInterpolator *mmi = _multimesh_get_interpolator(p_multimesh);
|
MultiMeshInterpolator *mmi = _multimesh_get_interpolator(p_multimesh);
|
||||||
if (mmi) {
|
if (mmi) {
|
||||||
|
if (p_interpolated == mmi->interpolated) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
mmi->interpolated = p_interpolated;
|
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.
|
// ... and that both prev and current are the same, just in case of any interpolations.
|
||||||
mmi->_data_prev = mmi->_data_curr;
|
mmi->_data_prev = mmi->_data_curr;
|
||||||
|
|
||||||
|
// Update the actual stable buffer to the backend.
|
||||||
|
_multimesh_set_buffer(rid, mmi->_data_interpolated);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!mmi) {
|
if (!mmi) {
|
||||||
|
|||||||
Reference in New Issue
Block a user