A lot of the usefulness of Shape2D comes from the fact that it's the only thing allowing people to draw rotated stuff to the screen right now. So it makes sense that a lot of the use of Shape2D is just to take a set of vertices, apply a linear transformation to it, then draw. Until this PR there was no way to change the linear transformation without clearing the entire vertex list and repushing everything, which is a slow operation. So this PR adds a system which natively allows a linear transformation using an associated Shape2DTransform class. The reason this is a separate class is so that the same transformation can be easily re-used over multiple Shape2Ds, as using multiple Shape2Ds is how you can use multiple textures in one.
On one of my more intensive tests of Shape2D, this can result in a substantial FPS increase, for example from ~95 fps without it to 170 fps with it. This results from caching the basic shape and then just setting the transformation when necessary.
PR: https://github.com/coelckers/gzdoom/pull/863
Add a linear transformation system to Shape2D
Moderator: GZDoom Developers
- Marisa the Magician
- Posts: 3886
- Joined: Fri Feb 08, 2008 9:15 am
- Preferred Pronouns: She/Her
- Operating System Version (Optional): (btw I use) Arch
- Graphics Processor: nVidia with Vulkan support
- Location: Vigo, Galicia
- Contact:
Re: Add a linear transformation system to Shape2D
As the person responsible for Shape2D I approve of this.
Re: Add a linear transformation system to Shape2D
I just tested the speed improvements gained from this and it's amazing how much of a difference this makes. Shape2D is so much more usable with this. :D
Re: Add a linear transformation system to Shape2D
Noticed this wasn't moved to Closed Feature Suggestions after being merged, so I've gone ahead and done that.