Effect Frame Update Optimization
The frame controller update function, used in mesh and texture effect animations, originally relied on a fixed loop (up to 20 iterations) to simulate the passage of frames based on the accumulated elapsed time. This had several downsides:
Inefficient CPU usage due to repeated branching.
Limited scalability – could miss frames if elapsed time was large.
More complex and harder-to-maintain code.
What's Improved with the Change?
The new logic replaces the loop with a direct calculation.
It computes how many frames should have passed based on the total elapsed time.
All necessary frame advancements are done at once, in a single operation.
Looping behavior and animation end conditions are still handled properly.
Benefits
Lower CPU usage – avoids unnecessary loops and branching.
Scales better – handles large time jumps (e.g., low FPS situations) more smoothly.
Cleaner, more maintainable code.
Summary
This optimization improves CPU efficiency and performance of mesh and texture effect animations during low-FPS situations, resulting in smoother visual effects. It does not guarantee a stable 60 FPS but ensures frame updates are handled more efficiently and responsively.
*Link download / Code:
EffectLib -> FrameController.cpp


la acest mesaj și conținutul se va afișa automat.
