summaryrefslogtreecommitdiffstats
path: root/servers/rendering/renderer_rd/storage_rd/mesh_storage.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'servers/rendering/renderer_rd/storage_rd/mesh_storage.cpp')
-rw-r--r--servers/rendering/renderer_rd/storage_rd/mesh_storage.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/servers/rendering/renderer_rd/storage_rd/mesh_storage.cpp b/servers/rendering/renderer_rd/storage_rd/mesh_storage.cpp
index 439d0702f5..487c314472 100644
--- a/servers/rendering/renderer_rd/storage_rd/mesh_storage.cpp
+++ b/servers/rendering/renderer_rd/storage_rd/mesh_storage.cpp
@@ -1392,12 +1392,18 @@ void MeshStorage::_multimesh_get_motion_vectors_offsets(RID p_multimesh, uint32_
MultiMesh *multimesh = multimesh_owner.get_or_null(p_multimesh);
ERR_FAIL_COND(!multimesh);
r_current_offset = multimesh->motion_vectors_current_offset;
- if (RSG::rasterizer->get_frame_number() - multimesh->motion_vectors_last_change >= 2) {
+ if (!_multimesh_uses_motion_vectors(multimesh)) {
multimesh->motion_vectors_previous_offset = multimesh->motion_vectors_current_offset;
}
r_prev_offset = multimesh->motion_vectors_previous_offset;
}
+bool MeshStorage::_multimesh_uses_motion_vectors_offsets(RID p_multimesh) {
+ MultiMesh *multimesh = multimesh_owner.get_or_null(p_multimesh);
+ ERR_FAIL_NULL_V(multimesh, false);
+ return _multimesh_uses_motion_vectors(multimesh);
+}
+
int MeshStorage::multimesh_get_instance_count(RID p_multimesh) const {
MultiMesh *multimesh = multimesh_owner.get_or_null(p_multimesh);
ERR_FAIL_COND_V(!multimesh, 0);
@@ -1500,6 +1506,10 @@ void MeshStorage::_multimesh_update_motion_vectors_data_cache(MultiMesh *multime
}
}
+bool MeshStorage::_multimesh_uses_motion_vectors(MultiMesh *multimesh) {
+ return (RSG::rasterizer->get_frame_number() - multimesh->motion_vectors_last_change) < 2;
+}
+
void MeshStorage::_multimesh_mark_dirty(MultiMesh *multimesh, int p_index, bool p_aabb) {
uint32_t region_index = p_index / MULTIMESH_DIRTY_REGION_SIZE;
#ifdef DEBUG_ENABLED