Closed eyworldwide closed 2 months ago
[!CAUTION]
Review failed
The pull request is closed.
The pull request introduces several static methods for creating materials in the SpriteMask
, SpriteRenderer
, and TextRenderer
classes. These methods configure materials for sprite masking, sprite rendering, and text rendering, respectively. The Engine
class has been updated to utilize these new methods, centralizing material creation and removing its previous material-related methods. Additionally, changes were made to the MaskManager
, RenderQueue
, and other components to enhance stencil state management and rendering processes.
Files | Change Summary |
---|---|
packages/core/src/2d/sprite/SpriteMask.ts |
Added static method _createSpriteMaskMaterial to create a material for sprite masking. |
packages/core/src/2d/sprite/SpriteRenderer.ts |
Added static method _createSpriteMaterial to create a material for rendering sprites with blending. |
packages/core/src/2d/text/TextRenderer.ts |
Added static method _createTextMaterial to create a material specifically for rendering text. |
packages/core/src/Engine.ts |
Updated imports and refactored to use new static methods for material creation; removed old material methods. |
packages/core/src/RenderPipeline/MaskManager.ts |
Renamed properties for encapsulation, added methods for drawing and clearing masks, and updated logic for mask management. |
packages/core/src/RenderPipeline/RenderQueue.ts |
Introduced new static properties and methods for handling stencil states and mask interactions. |
packages/core/src/enums/SpriteMaskLayer.ts |
Added new enum value Nothing to represent a "None mask layer." |
packages/core/src/index.ts |
Exported SpriteMaskLayer enum from the ./enums/SpriteMaskLayer module. |
packages/core/src/shader/state/RenderState.ts |
Updated constructor to include an optional customStencilStates parameter. |
packages/core/src/shader/state/StencilState.ts |
Enhanced _apply and _platformApply methods to accept custom states for more flexible stencil management. |
Shader.ts
file enhance how RenderState
settings are handled within the Material
, which is directly relevant to the new material creation logic introduced in the main PR for the SpriteMask
class.enhancement
, medium priority
, animation
π° In a world of sprites and text so bright,
New materials crafted, a coder's delight!
With shaders and states, they dance and play,
In the realm of rendering, they lead the way.
Hooray for the changes, let the pixels gleam,
A hop and a skip, weβre living the dream! π
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
Attention: Patch coverage is 54.07407%
with 62 lines
in your changes missing coverage. Please review.
Please upload report for BASE (
dev/1.4@afb7423
). Learn more about missing BASE report.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)
Extract some methods of the 2D renderers from the Engine. The code of
Engine
should be clean!Just like
this._textDefaultFont
is implemented throughFont.createFromOS
, it would be more reasonable for_spriteDefaultMaterial
to be implemented through the static method of its renderer class.Summary by CodeRabbit
New Features
RenderQueueMaskType
to categorize render queue masks.Refactor
Bug Fixes