Hokan
Member
|
[SOLVED] EE::Image rotation method
I have really dumb question.
Is there anywhere in EE rotation image method?
Sure, I can use image rotation formulas, like:
Code:
resultXPixelPosition = Cos(DegToRad(angleInDegrees)) *
(originalPixelXPosition - centerPixelXPosition) - Sin(DegToRad(angleInDegrees)) * (originalPixelYPosition - centerPixelYPosition) + centerPixelXPosition;
resultYPixelPosition = Sin(DegToRad(angleInDegrees)) *
(originalPixelXPosition - centerPixelXPosition) + Cos(DegToRad(angleInDegrees)) * (originalPixelYPosition - centerPixelYPosition) + centerPixelYPosition;
And iterate through all image pixels. But all this code will run on CPU, which is really slow.
Sure, I can write shade and use it over image, but doesn't EE already support GPU-based rotation image code?
(This post was last modified: 08-10-2015 08:05 AM by Hokan.)
|
|
08-06-2015 04:49 PM |
|
Esenthel
Administrator
|
RE: EE::Image rotation method
|
|
08-07-2015 12:29 AM |
|
Houge
Member
|
RE: EE::Image rotation method
Let me write another question about image rotation here, not to create a new topic.
Minimap consists of many image pieces, each one is drawn separtely to make a picture be without borders. Is there a built-in way to draw rotated minimap, and not to calculate manually tile position depending on current angle every frame?
|
|
08-07-2015 12:57 PM |
|
Esenthel
Administrator
|
RE: EE::Image rotation method
Hi,
There is no built-in way to do that.
Having source you'd have to combine the drawRotate method with the masked draw if you want a circle based minimap.
If you're ok with a square based mini map then you can just use D.clip combined with Image.drawRotate
|
|
08-08-2015 12:57 AM |
|
Hokan
Member
|
RE: EE::Image rotation method
Thanks for answer, but Image.drawRotate really draw rotated image. I'm searching for in-memory rotation method.
Is it possible to load image in GPURAM, run rotation shader once, than upload result image back in RAM, and would it worth passing image pixels back and forth, rather than just make CPU-based rotation?
Goal is - rare (once per 20-30 minutes) 512x512 (or 1024x1024) texture rotation
|
|
08-09-2015 09:17 AM |
|
Esenthel
Administrator
|
RE: EE::Image rotation method
I would just go with CPU algorithm, because capturing data from GPU is slow.
|
|
08-10-2015 07:04 AM |
|
Hokan
Member
|
RE: EE::Image rotation method
Thanks again, I'll mark post as solved
|
|
08-10-2015 08:05 AM |
|