[Added] Add a linear transformation system to Shape2D

Moderator: GZDoom Developers

Add a linear transformation system to Shape2D

Postby Gutawer » Fri Jun 07, 2019 1:58 pm

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
Gutawer
User Accounts Assistant
 
Joined: 16 Apr 2016
Discord: Gutawer#3431

Re: Add a linear transformation system to Shape2D

Postby Marisa Kirisame » Fri Jun 07, 2019 2:09 pm

As the person responsible for Shape2D I approve of this.
User avatar
Marisa Kirisame
ZScript Magician
 
 
 
Joined: 08 Feb 2008
Location: Vigo, Galicia
Discord: Marisa Kirisame#4689
Twitch ID: magusmarisa
Github ID: OrdinaryMagician
Operating System: Other Linux 64-bit
Graphics Processor: nVidia with Vulkan support

Re: Add a linear transformation system to Shape2D

Postby Nash » Sat Jun 08, 2019 3:44 am

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
Nash
 
 
 
Joined: 27 Oct 2003
Location: Kuala Lumpur, Malaysia
Github ID: nashmuhandes

Re: Add a linear transformation system to Shape2D

Postby Gutawer » Sat Jun 15, 2019 2:23 am

Noticed this wasn't moved to Closed Feature Suggestions after being merged, so I've gone ahead and done that.
User avatar
Gutawer
User Accounts Assistant
 
Joined: 16 Apr 2016
Discord: Gutawer#3431


Return to Closed Feature Suggestions

Who is online

Users browsing this forum: Awario [RSS] and 1 guest