Add a linear transformation system to Shape2D

Moderator: GZDoom Developers

Post Reply
User avatar
Gutawer
Posts: 469
Joined: Sat Apr 16, 2016 6:01 am
Preferred Pronouns: She/Her

Add a linear transformation system to Shape2D

Post by Gutawer »

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
User avatar
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

Post by Marisa the Magician »

As the person responsible for Shape2D I approve of this.
User avatar
Nash
 
 
Posts: 17439
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia
Contact:

Re: Add a linear transformation system to Shape2D

Post by Nash »

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
User avatar
Gutawer
Posts: 469
Joined: Sat Apr 16, 2016 6:01 am
Preferred Pronouns: She/Her

Re: Add a linear transformation system to Shape2D

Post by Gutawer »

Noticed this wasn't moved to Closed Feature Suggestions after being merged, so I've gone ahead and done that.
Post Reply

Return to “Closed Feature Suggestions [GZDoom]”