Closed lowswaplab closed 3 years ago
There is one problem. A non-square icon is "sheared" instead of simply rotated.
Update: It's not quite sheared... It's rotated within the icon's height and width. So, for example, an icon 310px wide by 175px high rotated 90 degrees: the image is rotated and squished so it is still 310px wide by 175px high rendered on the screen.
Placemark.js has a bunch of WebGL matrix transforms for rotation and tilt... I haven't worked with WebGL enough to know if the problem is in there...
What do you mean? Does this PR incorrect?
Show me screenshot.
If you want Placemark to be placed on terrain and rotated according to surface, then it should be not a Placemark, but surface image.
Should we reject this PR?
We should not reject this PR. We need to fix rotation though. Rotating a square works properly. Rotating a rectangle rotates it, but it's aspect ratio is wrong. I'll post a screenshot...
Yes, please, attach a screenshot. I can not understand what is the issue.
using a random rectangular png heading = 0 scale = 5
heading = 90 scale = 5
heading = 45 scale = 5
Have you checked standard examples of renderable.imageRotation attribute? How it is supposed to be used?
I didn't find any examples that use imageRotation.
According to my research, screen compass uses the same rotation logic (Matrix.multiplyByRotation) and it looks ok. As I understand if image canvas is square, then it rotates correctly.
Probably we should resize canvas of image to become square before rotation using maximal image dimension. This is not a KML processing issue, so I will do it out of this PR scope as separate enhanceement. Android code base has the same issue.
I have only one question regarding this PR - do you receive acceptable result when you rotate square Placemark and tilt globe camera? Is it OK for you, that icon faced screen surface, not a terrain surface and its rotation looks like not related to globe north in this view perspective?
I have created an issue ticked for the problem with Placemark rotation https://github.com/WorldWindEarth/worldwindjs/issues/63 If you will have ideas, let's discuss them there. It is a global issue with non-square images rotation in Android and JS code base.
Description of the Change
KML icons rotated according to IconStyle heading tag
Why Should This Be In Core?
To improve KML parsing.
Benefits
To improve KML parsing.
Potential Drawbacks
None.
Applicable Issues
None.