SFTtech / openage

Free (as in freedom) open source clone of the Age of Empires II engine 🚀
http://openage.dev
Other
12.51k stars 1.11k forks source link

Move subtex scaling to shader #1639

Closed heinezen closed 2 months ago

heinezen commented 2 months ago

Move the scaling of subtextures (i.e. handling of zoom, animation scaling, etc.) to the world shader.

Camera zoom and viewport size are send via the camera's uniform buffer, so these variables are now requested only once per frame. The world object's have to send an additional float as a uniform, but no longer have to calculate the scaling themselves which roughly halves the cycles spent on creating these uniform values.

The PR also fixes a bug in the alignment of uniforms in the uniform buffer that was previously not discovered. Uniforms where not properly aligned to a multiple of their size which resulted in the created buffer being too small and using the wrong offsets. This should now be fixed.