This repository has been archived by the owner on Dec 2, 2024. It is now read-only.
Make tilesheet frame rate independent of render path + fix race condition #163
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes armory3d/armory#1437.
Previously,
Tilesheet.update()
was called fromMeshObject.render()
which could be called multiple times per frame (with different contexts or in case of VR even twice with the same context). Because the tilesheet used the render frame time as a delta time, this could lead to wrong frame rates for example when there was both a "mesh" and a "shadowmap" context rendered in one frame.Now, all active tilesheets are updated once at the beginning of each frame and if the animation frame rate is higher than the render frame rate, multiple animation frames are now skipped correctly which wasn't the case before. This also fixes a possible race condition that could happen if the tilesheet frame is advanced in between multiple render passes. The centralized update could also improve cache coherency.
I also decided to make
Tilesheet.update()
private because it assumes that it is called only once per render frame.