dome icon indicating copy to clipboard operation
dome copied to clipboard

Arbitrary Sprite Transformations

Open avivbeeri opened this issue 4 years ago • 5 comments

DOME supports rotation (in 90 degree increments) and integer scaling, but I'd like to allow for arbitrary transformations (including skews and full 360 degree rotations).

This will matter more to people operating at higher resolutions. It's also essential that it be as performant as possible.

avivbeeri avatar Mar 06 '21 23:03 avivbeeri

I'm assuming that SDL2 has some function already available for this already?

benstigsen avatar Mar 06 '21 23:03 benstigsen

It does, but DOME doesn't use any of SDL's graphics routines so it doesn't directly help us.

avivbeeri avatar Mar 06 '21 23:03 avivbeeri

Okay, I can take a look at this if you want me to (?), I can then write about it in more detail if I figure something out and perhaps open up a PR.

benstigsen avatar Mar 06 '21 23:03 benstigsen

You are certainly welcome to. Some fresh eyes are always appreciated.

I toyed with a few approaches to this before DOME hot 1.0, they are sitting on the "basis" and "rotate" branches, but it's definitely not in a workable state at the moment.

avivbeeri avatar Mar 06 '21 23:03 avivbeeri

Hmm, I've taken a look at it, and with the 90 degrees it seems simple enough. But not sure what the math would be to calculate the new position rotated n degrees. Perhaps this works: https://stackoverflow.com/questions/26007202/calculate-new-point-offset-based-on-angle-of-rotation

benstigsen avatar Mar 08 '21 17:03 benstigsen