Skip to content

[FairyGUI] Add support for blending #2532

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
May 9, 2025
Merged

Conversation

rh101
Copy link
Contributor

@rh101 rh101 commented May 9, 2025

Describe your changes

DrawNode now inherits from BlendProtocol, since it does support blending. Also, ensure that the set BlendFunc is actually used, because it was hard-coded previously, so never used the correct blending modes. The change should not affect existing usage at all, since the default BlendFunc was BlendFunc::ALPHA_PREMULTIPLIED, which is {backend::BlendFactor::ONE, backend::BlendFactor::ONE_MINUS_SRC_ALPHA}, the same as what was being hard-coded:

blendDescriptor.sourceRGBBlendFactor        = backend::BlendFactor::ONE;
blendDescriptor.destinationRGBBlendFactor   = backend::BlendFactor::ONE_MINUS_SRC_ALPHA;
blendDescriptor.sourceAlphaBlendFactor      = backend::BlendFactor::ONE;
blendDescriptor.destinationAlphaBlendFactor = backend::BlendFactor::ONE_MINUS_SRC_ALPHA;

Which is now:

blendDescriptor.sourceRGBBlendFactor        = _blendFunc.src;
blendDescriptor.destinationRGBBlendFactor   = _blendFunc.dst;
blendDescriptor.sourceAlphaBlendFactor      = _blendFunc.src;
blendDescriptor.destinationAlphaBlendFactor = _blendFunc.dst;

Nothing else changes, as this is primarily an enhancement to allow blending when using FairyGUI components. The FairyGUI code changes are based of FairyGUI libraries for other engines, so the API is similar to their other implementations.

Issue ticket number and link

#2486

Checklist before requesting a review

For each PR

  • Add Copyright if it missed:
    - "Copyright (c) 2019-present Axmol Engine contributors (see AUTHORS.md)."

  • I have performed a self-review of my code.

    Optional:

    • I have checked readme and add important infos to this PR.
    • I have added/adapted some tests too.

For core/new feature PR

  • I have checked readme and add important infos to this PR.
  • I have added thorough tests.

@halx99 halx99 added this to the 2.6.0 milestone May 9, 2025
@halx99 halx99 linked an issue May 9, 2025 that may be closed by this pull request
@halx99 halx99 merged commit 8dab60e into axmolengine:dev May 9, 2025
15 checks passed
@rh101 rh101 deleted the fairygui-blendmode branch May 9, 2025 12:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

FairyGUI: Unable to Use BlendMode due to The Lack of Its Implementation
2 participants