WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   Why does a mask object automatically flip an art horizontally? (https://www.wowinterface.com/forums/showthread.php?t=55807)

Layback_ 10-17-17 05:51 AM

Why does a mask object automatically flip an art horizontally?
 
Hi all,

Just for testing, I have made a parallelogram texture and applied this on a plain texture object as well as on a texture object with a mask object.

The first one draws an art as it is while the second one automatically flips an art horizontally...



Here's an exact code snippet:

Lua Code:
  1. local mask = UIParent:CreateMaskTexture();
  2. mask:SetTexture(parallel);
  3. mask:SetSize(256, 32);
  4. mask:SetPoint("RIGHT", UIParent, "CENTER", -50, 0);
  5.  
  6. local texture1 = UIParent:CreateTexture(nil, "ARTWORK");
  7. texture1:SetColorTexture(1, 1, 1);
  8. texture1:SetAllPoints(mask);
  9. texture1:AddMaskTexture(mask);
  10.  
  11. local texture2 = UIParent:CreateTexture(nil, "ARTWORK");
  12. texture2:SetTexture(parallel);
  13. texture2:SetSize(256, 32);
  14. texture2:SetPoint("LEFT", UIParent, "CENTER", 50, 0);

Is this an intended behavior of a mask object?

Thank you!

vis781 12-06-17 11:10 AM

Hi, in my experience with masking in wow it doesn't..... some code I just tested using a mask created in gimp that turns any texture in to a circle works fine.

Code:

local tex = Frame:CreateTexture(nil, "ARTWORK", nil, 0);
        tex:SetTexture(some texture);
        tex:SetAllPoints(Frame);
        tex:SetMask(Some Path to CircularMask.tga")


MunkDev 12-06-17 06:57 PM

Quote:

Originally Posted by vis781 (Post 326022)
Hi, in my experience with masking in wow it doesn't..... some code I just tested using a mask created in gimp that turns any texture in to a circle works fine.

A circle looks the same when horizontally flipped, no?
I can confirm this problem exists, because I created all these mask textures:


When rendered in game, most of them are wrong, so I had to map the opposing mask to the texture it was meant for.

Resike 12-07-17 04:49 AM

Didn't they fixed this? Maybe it's just not live yet.

MunkDev 12-08-17 01:04 AM

Quote:

Originally Posted by Resike (Post 326056)
Didn't they fixed this? Maybe it's just not live yet.

They fixed the issue with unrelated masks linking together in the back-end, but it seems the calculations are still reversed. My code kinda reveals the issue.
Notice how I swapped M1 left/right with the corresponding masks for M2.
Lua Code:
  1. ['M1'] = {
  2.     up = TEX_PATH:format([[Masks\M1_down]]),
  3.     down = TEX_PATH:format([[Masks\M1_up]]),
  4.     left = TEX_PATH:format([[Masks\M2_left]]),
  5.     right = TEX_PATH:format([[Masks\M2_right]]),
  6. },
  7. ['M2'] = {
  8.     up = TEX_PATH:format([[Masks\M2_down]]),
  9.     down = TEX_PATH:format([[Masks\M2_up]]),
  10.     left = TEX_PATH:format([[Masks\M1_left]]),
  11.     right = TEX_PATH:format([[Masks\M1_right]]),
  12. },
This is still happening on the PTR, but if it never gets fixed it's as easy as horizontally flipping your mask texture to work around it.
From a programming perspective, I would imagine whoever implemented this only used symmetrical textures (as most masks are) during testing.

vis781 12-08-17 09:14 AM

Quote:

Originally Posted by MunkDev (Post 326045)
A circle looks the same when horizontally flipped, no?
I can confirm this problem exists, because I created all these mask textures:


When rendered in game, most of them are wrong, so I had to map the opposing mask to the texture it was meant for.

Erm, yes, but only if the texture was a mirror of itself on the considered axis, we're not talking about the mask used, we're talking about the texture. Try the code snippet I posted. SetMask does not flip the texture, I am and have used it multiple time in my addon.

vis781 12-08-17 09:16 AM

and what do you mean "Rendered in game" You don't render a mask, in fact is the complete opposite of that.

vis781 12-08-17 09:19 AM

and secondly, why all the different colors? The engine uses Mask Alpha only

lightspark 12-08-17 02:10 PM

Quote:

Originally Posted by vis781 (Post 326066)
Erm, yes, but only if the texture was a mirror of itself on the considered axis, we're not talking about the mask used, we're talking about the texture. Try the code snippet I posted. SetMask does not flip the texture, I am and have used it multiple time in my addon.

People in this thread are talking about relatively new mask textures (created via CreateMaskTexture) and not old masks (set via SetMask). They work differently.

Mask textures are still a bit buggy.

vis781 12-08-17 02:58 PM

I've has look further in to this and th reason I can't replicate the problem is becuase all masks i use are symmetrical, but that is how masks are in C. So for me the behaviour of the function is expected. The problem you are seeing may well be result of the raster operations performed to make the mask "work" for the want if a better word. It will likely combine bitwise and/or to crop out the mask and then apply srcalpha at the end. This is and has been the standard way of masking for a long time, and it is the fastest to my knowledge. However the result of the raster operation are a flipped image. Which may well be why you don't see asymmetrical masks in the bliz art.

MunkDev 12-08-17 03:50 PM

Quote:

Originally Posted by vis781 (Post 326066)
Erm, yes, but only if the texture was a mirror of itself on the considered axis, we're not talking about the mask used, we're talking about the texture. Try the code snippet I posted. SetMask does not flip the texture, I am and have used it multiple time in my addon.

You're talking about an old function native to textures, this thread is discussing MaskTexture widgets. MaskTexture is a relatively new widget, designed to replace the old texture function and to be a lot more versatile.

Quote:

Originally Posted by vis781 (Post 326067)
and what do you mean "Rendered in game" You don't render a mask, in fact is the complete opposite of that.

When the TEXTURE is rendered in game [...]. Happy now?

Quote:

Originally Posted by vis781 (Post 326068)
and secondly, why all the different colors? The engine uses Mask Alpha only

It's a compilation. The mask is the black part. Colors are there to distinguish the boundaries of each mask.

You must be new here. :rolleyes:

vis781 12-08-17 04:15 PM

New yes, but I'm finding my feet and I believe I have something to offer as well as learn a thing or two myself.

Resike 12-09-17 08:43 AM

I poked a dev, it's gonna be looked into.

lightspark 01-28-18 09:01 PM

This issue was fixed in 7.3.5.


All times are GMT -6. The time now is 06:52 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI