View Single Post
04-23-13, 09:11 AM   #29
Resike
A Pyroguard Emberseer
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,290
Okay i came up with something like that:

Code:
	if (aura.textaura ~= true) then
		texture:SetRotation(math.rad(aura.rotate));
	end
	if (aura.customtex == true) or (aura.owntex == true) then
		local ULx, ULy, LLx, LLy, URx, URy, LRx, LRy = texture:GetTexCoord();
		local x = (sqrt(2) - 1) / 2
		if string.find(aura.customname, "//") then
			if (aura.rotate == 0) or (aura.rotate == 360) then
				texture:SetTexCoord(ULx + x, ULy + x, LLx + x, LLy - x, URx - x, URy + x, LRx - x, LRy - x);
			elseif (aura.rotate == 90) then
				texture:SetTexCoord(ULx + x, ULy + x, LLx - x, LLy + x, URx + x, URy - x, LRx - x, LRy - x);
			elseif (aura.rotate == 180) then
				texture:SetTexCoord(ULx + x, ULy - x, LLx + x, LLy + x, URx - x, URy - x, LRx - x, LRy + x);
			elseif (aura.rotate == 270) then
				texture:SetTexCoord(ULx - x, ULy - x, LLx + x, LLy - x, URx - x, URy + x, LRx + x, LRy + x);
			end
		else
			if (aura.rotate == 0) or (aura.rotate == 360) then
				texture:SetTexCoord(ULx + x, ULy + x, LLx + x, LLy - x, URx - x, URy + x, LRx - x, LRy - x);
			elseif (aura.rotate == 90) then
				texture:SetTexCoord(ULx - x, ULy + x, LLx + x, LLy + x, URx - x, URy - x, LRx + x, LRy - x);
			elseif (aura.rotate == 180) then
				texture:SetTexCoord(ULx - x, ULy - x, LLx - x, LLy + x, URx + x, URy - x, LRx + x, LRy + x);
			elseif (aura.rotate == 270) then
				texture:SetTexCoord(ULx + x, ULy - x, LLx - x, LLy - x, URx + x, URy + x, LRx - x, LRy + x);
			end
		end
	end
	if (aura.textaura ~= true) then
		local ULx, ULy, LLx, LLy, URx, URy, LRx, LRy = texture:GetTexCoord();
		if (aura.symetrie == 1) then
			texture:SetTexCoord(URx, URy, LRx, LRy, ULx, ULy, LLx, LLy); -- Inverse X
		elseif (aura.symetrie == 2) then
			texture:SetTexCoord(LLx, LLy, ULx, ULy, LRx, LRy, URx, URy); -- Inverse Y
		elseif (aura.symetrie == 3) then
			texture:SetTexCoord(LRx, LRy, URx, URy, LLx, LLy, ULx, ULy); -- Inverse XY
		else
			texture:SetTexCoord(ULx, ULy, LLx, LLy, URx, URy, LRx, LRy); -- Normal
		end
	end
	if (aura.textaura == true) then
		frame.baseH = 256 * aura.size * (2 - aura.torsion);
	elseif (aura.customtex == true) then
		local x = (sqrt(2) * 2) - 1
		if string.find(aura.customname, "//") then
			if (aura.rotate == 0) or (aura.rotate == 180) or (aura.rotate == 360) then
				frame.baseH = 256 * aura.size * (2 - aura.torsion);
			elseif (aura.rotate == 90) or (aura.rotate == 270) then
				frame.baseH = x * 256 * aura.size * (2 - aura.torsion);
			else
				frame.baseH = sqrt(2) * 256 * aura.size * (2 - aura.torsion);
			end
		else
			if (aura.rotate == 0) or (aura.rotate == 180) or (aura.rotate == 360) then
				frame.baseH = 256 * aura.size * (2 - aura.torsion);
			elseif (aura.rotate == 90) or (aura.rotate == 270) then
				frame.baseH = 256 * aura.size * (2 - aura.torsion);
			else
				frame.baseH = sqrt(2) * 256 * aura.size * (2 - aura.torsion);
			end
		end
	elseif (aura.owntex == true) then
		if (aura.rotate == 0) or (aura.rotate == 180) or (aura.rotate == 360) then
			frame.baseH = 256 * aura.size * (2 - aura.torsion);
		elseif (aura.rotate == 90) or (aura.rotate == 270) then
			frame.baseH = 256 * aura.size * (2 - aura.torsion);
		else
			frame.baseH = sqrt(2) * 256 * aura.size * (2 - aura.torsion);
		end
	else
		frame.baseH = sqrt(2) * 256 * aura.size * (2 - aura.torsion);
		frame.baseL = sqrt(2) * 256 * aura.size * aura.torsion;
	end
	if (aura.textaura == true) then
		local fontsize = math.min(33, math.max(10, math.floor(frame.baseH / 12.8)));
		local checkfont = texture:SetFont(self.Fonts[aura.aurastextfont], fontsize, "OUTLINE, MONOCHROME");
		if not checkfont then
			texture:SetFont(STANDARD_TEXT_FONT, fontsize, "OUTLINE, MONOCHROME");
		end
		frame.baseL = texture:GetStringWidth() + 5;
	elseif (aura.customtex == true) then
		local x = (sqrt(2) * 2) - 1
		if string.find(aura.customname, "//") then
			if (aura.rotate == 0) or (aura.rotate == 360) then
				frame.baseL = 256 * aura.size * aura.torsion;
			elseif (aura.rotate == 90) or (aura.rotate == 270) then
				frame.baseL = 256 * aura.size * aura.torsion;
			elseif (aura.rotate == 180) then
				frame.baseL = x * 256 * aura.size * aura.torsion;
			else
				frame.baseL = sqrt(2) * 256 * aura.size * aura.torsion;
			end
		else
			if (aura.rotate == 0) or (aura.rotate == 180) or (aura.rotate == 360) then
				frame.baseL = 256 * aura.size * aura.torsion;
			elseif (aura.rotate == 90) or (aura.rotate == 270) then
				frame.baseL = 256 * aura.size * aura.torsion;
			else
				frame.baseL = sqrt(2) * 256 * aura.size * aura.torsion;
			end
		end
	elseif (aura.owntex == true) then
		if (aura.rotate == 0) or (aura.rotate == 180) or (aura.rotate == 360) then
			frame.baseL = 256 * aura.size * aura.torsion;
		elseif (aura.rotate == 90) or (aura.rotate == 270) then
			frame.baseL = 256 * aura.size * aura.torsion;
		else
			frame.baseL = sqrt(2) * 256 * aura.size * aura.torsion;
		end
	end
	PowaAuras:InitialiseFrame(aura, frame);
It lets you rotate any textures, but it shows properly "bugged" textures too at 0, 90, 180, 270 degree. Also the mirroring works on them too.
  Reply With Quote