Jump to content

Apply sprite mask to another sprite not working


corporalik
 Share

Recommended Posts

Hello all.

I'm trying to apply mask which is sprite and contains a lot of graphic objects, to another sprite with other graphic objects, but it's not working.

Here is my example https://jsfiddle.net/jtzqhge2/1/

As you can see on result there is only one piece of mask, but I attached 5 pieces of graphic objects to mask container and then apply that container as mask. Any ideas?

 

White object is what I want to mask, red objects are parts of mask

post-17984-0-59731700-1450867052.jpg

 

Here is result

post-17984-0-29499800-1450867052.jpg

 

Thanks

Link to comment
Share on other sites

https://jsfiddle.net/jtzqhge2/3/ - if you use graphics object as a mask, it will work.

 

According to https://github.com/pixijs/pixi.js/blob/master/src/core/renderers/webgl/managers/StencilManager.js#L314 , only one object can be used for masking

WebGLMaskManager.prototype.pushMask = function (maskData){    this.renderer.setObjectRenderer(this.renderer.plugins.graphics);    if (maskData.dirty)    {        this.renderer.plugins.graphics.updateGraphics(maskData, this.renderer.gl);    }    if (!maskData._webGL[this.renderer.gl.id].data.length)    {        return;    }    this.pushStencil(maskData, maskData._webGL[this.renderer.gl.id].data[0]);};
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...