WoW:SetTexCoord Transformations: Difference between revisions

Added a simpler rotateTexture() function
(Added a non-matrix example of rotating a square texture)
(Added a simpler rotateTexture() function)
Line 169: Line 169:
 
 
  texture:SetTexCoord(ULx, ULy, LLx, LLy, URx, URy, LRx, LRy);
  texture:SetTexCoord(ULx, ULy, LLx, LLy, URx, URy, LRx, LRy);
end
==Even simpler rotation of textures about the center==
function RotateTexture(self, degrees)
local angle = math.rad(degrees)
local cos, sin = math.cos(angle), math.sin(angle)
self:SetTexCoord((sin - cos), -(cos + sin), -cos, -sin, sin, -cos, 0, 0)
  end
  end
Anonymous user