diff options
author | Ricardo Buring <ricardo.buring@gmail.com> | 2022-12-10 21:57:44 +0100 |
---|---|---|
committer | clayjohn <claynjohn@gmail.com> | 2023-02-03 11:40:39 -0800 |
commit | 497f5576c18a7487c54c630bbe1ff4f9171bb08c (patch) | |
tree | d27ac568e18a35a29a7f96ecf126133e6d9613cf /servers/rendering/renderer_rd/storage_rd | |
parent | 604493eb6ee3def65aca089c1d4bc71ea03ca19a (diff) |
Fix MultiMesh visible_instance_count being ignored after the first frame
Co-authored-by: Clay John <claynjohn@gmail.com>
Diffstat (limited to 'servers/rendering/renderer_rd/storage_rd')
-rw-r--r-- | servers/rendering/renderer_rd/storage_rd/mesh_storage.cpp | 6 |
1 files changed, 5 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 6894498af5..96618c3352 100644 --- a/servers/rendering/renderer_rd/storage_rd/mesh_storage.cpp +++ b/servers/rendering/renderer_rd/storage_rd/mesh_storage.cpp @@ -1805,8 +1805,12 @@ void MeshStorage::multimesh_set_visible_instances(RID p_multimesh, int p_visible } if (multimesh->data_cache.size()) { - //there is a data cache.. + // There is a data cache, but we may need to update some sections. _multimesh_mark_all_dirty(multimesh, false, true); + int start = multimesh->visible_instances >= 0 ? multimesh->visible_instances : multimesh->instances; + for (int i = start; i < p_visible; i++) { + _multimesh_mark_dirty(multimesh, i, true); + } } multimesh->visible_instances = p_visible; |