mirror of
https://github.com/godotengine/godot.git
synced 2025-12-08 06:09:55 +00:00
FTI - Fix MultiMesh init and stable behaviour
This commit is contained in:
parent
e1b4101e34
commit
02b444a988
1 changed files with 16 additions and 0 deletions
|
|
@ -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) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue