Last active
September 6, 2018 11:56
-
-
Save Makizemi/e2b1c2eae5f7941fc825bfff5e070241 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
float2 TranslateSt(float2 st, float2 pos) | |
{ | |
float3x3 mat = float3x3( | |
1, 0, pos.x, | |
0, 1, pos.y, | |
0, 0, 1); | |
st -= 0.5; | |
st = mul(mat, float3(st, 1)); | |
st += 0.5; | |
return st; | |
} | |
float2 RotateSt(float2 st, float angle) | |
{ | |
float3x3 mat = float3x3( | |
cos(angle), -sin(angle), 0, | |
sin(angle), cos(angle), 0, | |
0, 0, 1); | |
st -= 0.5; | |
st = mul(mat, float3(st, 1)); | |
st += 0.5; | |
return st; | |
} | |
float2 ResizeSt(float2 st, float2 scale) | |
{ | |
float3x3 mat = float3x3( | |
scale.x, 0, 0, | |
0, scale.y, 0, | |
0, 0, 1); | |
st -= 0.5; | |
st = mul(mat, float3(st, 1)); | |
st += 0.5; | |
return st; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment