Jump to content

stop parent mask from being applied to children


thekayaker33
 Share

Recommended Posts

Yeah that worked, i just changed the renderAdvanced() from 

	if (mask)
        {
            renderer.mask.push(this, this._mask);
        }
        // add this object to the batch, only rendered if it has a texture.
        this._render(renderer);
        // now loop through the children and make sure they get rendered
        for (let i = 0, j = this.children.length; i < j; i++)
        {
            this.children[i].render(renderer);
        }
        renderer.batch.flush();
        if (mask)
        {
            renderer.mask.pop(this);
        }

to 

        if (mask)
        {
            renderer.mask.push(this, this._mask);
        }
        // add this object to the batch, only rendered if it has a texture.
        this._render(renderer);
        // now loop through the children and make sure they get rendered


        for (let i = 0, j = this.children.length; i < j; i++)
        {
            if(this.children[i].ignoreParentMask == null){
                this.children[i].render(renderer);
            }
            else if(this.children[i].ignoreParentMask == true){

                if (mask)
                {
                    renderer.batch.flush();
                    renderer.mask.pop(this);

                    this.children[i].render(renderer);
                    renderer.batch.flush();

                    renderer.mask.push(this, this._mask);

                }
                else{
                    this.children[i].render(renderer);
                }

            }
            else{
                this.children[i].render(renderer);
            }


        }
        renderer.batch.flush();

        if (mask)
        {
            renderer.mask.pop(this);
        }

 

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...