1
0
mirror of https://github.com/DigvijaysinhGohil/Godot-Shader-Lib.git synced 2025-01-09 02:43:25 +08:00
Godot-Shader-Lib/addons/ShaderLib/UV/RotateUV.gdshaderinc
Digvijaysinh Gohil 4628159c6e Update RotateUV.gdshaderinc
RotateUV node shader logic simplified.
2023-12-10 18:21:52 +05:30

10 lines
355 B
Plaintext

vec2 rotate_uv(vec2 uv, vec2 center, float rotation, bool use_degrees){
float _angle = rotation;
if(use_degrees){
_angle = rotation * (3.1415926/180.0);
}
vec2 _delta = uv - center;
float _x = cos(_angle) * _delta.x - sin(_angle) * _delta.y;
float _y = sin(_angle) * _delta.x + cos(_angle) * _delta.y;
return vec2(_x + center.x, _y + center.y);
}