//Pivot
float2 pivot = float2(0.5,0.5);//定义旋转中心
//Rotation Matrix
float cosAngle = cos(angle);//取时间当角度
float sinAngle = sin(angle);
float2x2 rot = float2x2(cosAngle,-sinAngle,sinAngle,cosAngle);//构造2维旋转矩阵
例如:
//Rotation consedering pivot
float2 uv = v.texcoord.xy - pivot;//先移到中心旋转
o.uv = mul(rot,uv);
o.uv += pivot;//再移回来