When using a non-square image as a texture, we set the vScale of the texture to the aspect ratio so that the image is not distorted. This all works fine. The issue arises when attempting to rotate the texture with wAng. When doing so, the image is distorted by the non-uniform scaling. Here is a very simple playground you can use to see the issue. Slide the wAng value to see the distortion. Specific slide it to PI / 4 which is around .78. Slide the the vScale value to see that no corrective action is possible to fix the distortion.
It is unlikely that someone in the past has actually desired that distortion, right? prepareRowForTextureGeneration seems to be around the correct area where the issue is and perhaps it involves some interpolation between the u and v scale as the rotation changes?
I already attempted the interpolation and found no vScale can be applied to fix the distortion (as seen in the playground when adjusting the vScale). Thatās why I created the bug report, because I couldnāt find any corrective action to take on my end.
Conceptually, if you look at uOffset and vOffset, they both follow the axis of rotation (after wAng changes, the offset axes also rotate). Then, with uScale and vScale, they exhibit different behavior where the axes donāt update with rotation changes.
Needs to be transformed by wAng before being used.
In the following playground you can see that I roughly altered getTextureMatrix around line 78 so that it Lerps between the 0 and 1 in that matrix based on wAng. At a specific rotation (specifically ~1.2 radians), it does actually remove distortion. Overall though it doesnāt work right. I think fundamentally I donāt understand what that matrix is and how it needs to be transformed.