Add a linear transformation system to Shape2D

Post a reply

Smilies
:D :) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :wink: :geek: :ugeek: :!: :?: :idea: :arrow: :| :mrgreen: :3: :wub: >:( :blergh:
View more smilies

BBCode is OFF
Smilies are ON

Topic review
   

Expand view Topic review: Add a linear transformation system to Shape2D

Re: Add a linear transformation system to Shape2D

by Gutawer » Sat Jun 15, 2019 1:23 am

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

Re: Add a linear transformation system to Shape2D

by Nash » Sat Jun 08, 2019 2: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

Re: Add a linear transformation system to Shape2D

by Marisa the Magician » Fri Jun 07, 2019 1:09 pm

As the person responsible for Shape2D I approve of this.

Add a linear transformation system to Shape2D

by Gutawer » Fri Jun 07, 2019 12: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

Top