Created
August 12, 2020 12:42
-
-
Save chengkehan/edc0140c938ed2c8e1b5b36f78d37f89 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// rotation and transform a 2d array | |
// aniticlockwise 90 degree | |
Vector2[] tUV2 = new Vector2[tUV.Length]; | |
System.Array.Copy(tUV, 0, tUV2, 0, tUV.Length); | |
for (int pi = 0; pi < h; ++pi) | |
{ | |
for (int pj = 0; pj < w; ++pj) | |
{ | |
Vector2 pc = tUV2[pi * w + pj]; | |
tUV[(w - pj - 1) * w + pi] = pc; | |
} | |
} | |
System.Array.Copy(tUV, 0, tUV2, 0, tUV.Length); | |
// Flip horizontal | |
for (int pi = 0; pi < h; ++pi) | |
{ | |
for (int pj = 0; pj < w; ++pj) | |
{ | |
Vector2 pc = tUV2[pi * w + pj]; | |
tUV[(w - pi - 1) * w + pj] = pc; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment